Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs Stopwatch

Siticone Stopwatch

The SiticoneStopwatch is a fully functional, animated stopwatch component. It features Start/Pause/Reset controls, a scrollable lap history list, millisecond precision, and ripple animation effects on button clicks.

Visual Styling

Customize the colors of the time display, buttons, and lap list to match your application.

Property Type Description & Usage Example
PrimaryColor Color stopwatch.PrimaryColor = Color.DodgerBlue; The color of the active progress arc around the time.
SecondaryColor Color stopwatch.SecondaryColor = Color.LightGray; The color of the inactive track ring.
ButtonColor Color stopwatch.ButtonColor = Color.WhiteSmoke; The background color of the control buttons (Start, Lap, Reset).
ButtonHoverColor Color stopwatch.ButtonHoverColor = Color.Gainsboro; The background color of buttons when hovered.
IconColor Color stopwatch.IconColor = Color.Black; The color of the icons (Play, Pause, Flag) inside the buttons.
LapBadgeColor Color stopwatch.LapBadgeColor = Color.OrangeRed; The color of the badge showing the total lap count.

Typography

Control the fonts used for the main time display and the lap list items.

Property Type Description & Usage Example
TimeFont Font stopwatch.TimeFont = new Font("Segoe UI", 24F, FontStyle.Bold); The font for the main digital timer.
LapFont Font stopwatch.LapFont = new Font("Consolas", 10F); The font used for the list of recorded laps.

Public Methods

Control Methods
// Starts the stopwatch timer.
stopwatch.Start();

// Pauses the timer without resetting.
stopwatch.Pause(); // Alias: Stop()

// Resets the timer to 00:00.00 and clears laps.
stopwatch.Reset();

// Records the current time as a lap split.
stopwatch.RecordLap();

Events

Hook into the stopwatch lifecycle to trigger external actions.

Event Descriptions & Wiring
// 1. Tick Event
// Fires continuously while running (approx every 30ms).
stopwatch.Tick += (s, e) => 
{
                // e.ElapsedTime contains the current TimeSpan
    progressBar1.Value = e.ElapsedTime.Seconds;
};

// 2. StateChanged Event
// Fires when switching between Stopped, Running, or Paused.
stopwatch.StateChanged += (s, e) => 
{
    lblStatus.Text = $"Status: {e.NewState}";
};

// 3. LapAdded Event
// Fires when a lap is recorded.
stopwatch.LapAdded += (s, e) => 
{
                Console.WriteLine($"Lap {e.LapNumber}: {e.LapTime}");
};

// 4. Resetting Event (Cancellable)
// Fires before a reset occurs. Can be cancelled.
stopwatch.Resetting += (s, e) => 
{
                if (MessageBox.Show("Clear all laps?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.No)
    {
        e.Cancel = true;
    }
};

Detailed Usage Examples

Example 1: Dark Mode Theme

A sleek, dark-themed stopwatch suitable for professional dashboards.

C# - Dark Theme
private void ApplyDarkTheme()
{
    stopwatch.BackColor = Color.FromArgb(40, 40, 40);
    stopwatch.ForeColor = Color.White;
    
    stopwatch.PrimaryColor = Color.Cyan;
    stopwatch.SecondaryColor = Color.FromArgb(60, 60, 60);
    
    stopwatch.ButtonColor = Color.FromArgb(50, 50, 50);
    stopwatch.ButtonHoverColor = Color.FromArgb(70, 70, 70);
    stopwatch.IconColor = Color.White;
    
    stopwatch.LapBadgeColor = Color.DeepSkyBlue;
}

Example 2: Race Timer Logic

Using events to automatically log laps to an external list or database.

C# - Race Logic
public void InitializeRaceTimer()
{
    siticoneStopwatch1.LapAdded += LogLapToDatabase;
    siticoneStopwatch1.Started += (s, e) => Console.WriteLine("Race Started!");
}

private void LogLapToDatabase(object sender, SiticoneStopwatch.LapEventArgs e)
{
                // e.LapDuration is the time since the last lap (split)
                // e.LapTime is the total elapsed time
                string logEntry = $"Lap {e.LapNumber}: {e.LapDuration} (Total: {e.LapTime})";
    
                SaveToDb(logEntry);
}

Example 3: Auto-Stop Feature

Automatically pausing the stopwatch after a specific duration.

C# - Auto Stop
private TimeSpan _maxDuration = TimeSpan.FromMinutes(5);

private void InitializeLimiter()
{
    siticoneStopwatch1.Tick += CheckDuration;
}

private void CheckDuration(object sender, SiticoneStopwatch.TimerTickEventArgs e)
{
                if (e.ElapsedTime >= _maxDuration)
    {
        siticoneStopwatch1.Pause();
                MessageBox.Show("Time limit reached!");
    }
}

Example 4: Custom "Ruby Red" Theme

A vibrant red theme suitable for urgent or warning timers.

C# - Ruby Theme
private void ApplyRubyTheme()
{
    stopwatch.PrimaryColor = Color.FromArgb(231, 76, 60); // Red
    stopwatch.SecondaryColor = Color.FromArgb(250, 215, 215);
    
    stopwatch.ButtonColor = Color.White;
    stopwatch.ButtonHoverColor = Color.MistyRose;
    stopwatch.IconColor = Color.DarkRed;
    
    stopwatch.LapBadgeColor = Color.Firebrick;
    
                // Increase animation speed for snappiness
    stopwatch.AnimationSpeed = 24;
}