Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs Close Button Advanced

Siticone Close Button Advanced

The SiticoneCloseButtonAdvanced is a high-end window management control designed for modern user interfaces. It transforms the standard close action into an interactive experience with features like timed countdowns, material design spinners, gradient backgrounds, and sound feedback. It also includes deep integration with parent forms to handle automatic closing, minimizing, and preventing accidental exits.

Countdown & Logic

Properties that control the delayed closing mechanism and core logic.

Property Type Description & Usage Example
CountdownMode bool btn.CountdownMode = true; If true, clicking the button starts a timer instead of closing immediately.
CountdownSeconds int btn.CountdownSeconds = 3; The duration of the countdown in seconds.
ShowCountdownText bool btn.ShowCountdownText = true; Displays the remaining seconds as text.
CancelOnSecondClick bool btn.CancelOnSecondClick = true; Allows the user to stop the countdown by clicking the button again.
CloseFormAutomatically bool btn.CloseFormAutomatically = true; If true, the parent form closes (or minimizes) automatically when the countdown reaches zero.
DisplayMode CountdownDisplayMode btn.DisplayMode = CountdownDisplayMode.InsideControl; Positions the text: InsideControl, BelowControl, or NoDisplay.

Form Integration

Advanced features for controlling the parent form behavior.

Property Type Description & Usage Example
IntegrateWithFormClosing bool btn.IntegrateWithFormClosing = true; If true, intercepts the parent form's FormClosing event (e.g., Alt+F4) and triggers the button's countdown logic instead of closing immediately.
MinimizeInsteadOfClose bool btn.MinimizeInsteadOfClose = true; Changes the action to minimize the form rather than close it when triggered.

Input & Sound

Settings for keyboard shortcuts, mouse interaction, and audio feedback.

Property Type Description & Usage Example
EnableDoubleClickAction bool btn.EnableDoubleClickAction = true; Enables special handling for double-click events.
DoubleClickClosesImmediately bool btn.DoubleClickClosesImmediately = true; If true, double-clicking bypasses the countdown and closes/minimizes the form instantly.
ShortcutKey Keys btn.ShortcutKey = Keys.Escape; Defines a keyboard key to trigger the button. Requires integration via ProcessCloseShortcut in the form's key handler.
EnableSounds bool btn.EnableSounds = true; Plays system audio cues during countdown ticks and completion.
CountdownTickSound string btn.CountdownTickSound = "Tick"; Sound played every second. Options: "Tick", "Beep", etc.
CountdownCompleteSound string btn.CountdownCompleteSound = "Complete"; Sound played when the countdown finishes.

Animation & Material Design

Visual settings for the progress indicator and spinners.

Property Type Description & Usage Example
EnableAnimation bool btn.EnableAnimation = true; Master toggle for all visual animations.
EnableUltraPerformanceMode bool btn.EnableUltraPerformanceMode = true; When enabled, disables all timers and complex rendering effects for maximum speed. Useful for high-density UIs.
AnimationStyle AdvancedCloseButtonAnimationType btn.AnimationStyle = AdvancedCloseButtonAnimationType.MaterialIndicator; CircularProgress: A smooth ring filling up.
MaterialIndicator: A segmented, spinning loader.
MaterialIndicatorSegments int btn.MaterialIndicatorSegments = 12; The number of ticks/segments in the Material style spinner.
MaterialRotationSpeed float btn.MaterialRotationSpeed = 15f; The speed of rotation for the Material indicator.
MaterialIndicatorOpacity int btn.MaterialIndicatorOpacity = 220; Maximum opacity (0-255) for the spinner segments.

Appearance

Colors, sizes, and gradient background options.

Property Type Description & Usage Example
IconColor Color btn.IconColor = Color.Gray;
HoverColor Color btn.HoverColor = Color.Red;
CountdownColor Color btn.CountdownColor = Color.DarkRed;
BackgroundHoverColor Color btn.BackgroundHoverColor = Color.LightGray;
CountdownBackgroundColor Color btn.CountdownBackgroundColor = Color.WhiteSmoke;
UseGradientBackground bool btn.UseGradientBackground = true; Enables gradient fill for the button background.
GradientStartColor Color btn.GradientStartColor = Color.White;
GradientEndColor Color btn.GradientEndColor = Color.Silver;
IconSize int btn.IconSize = 12;
LineThickness int btn.LineThickness = 2;
ButtonCursor Cursor btn.ButtonCursor = Cursors.Hand;

Public Methods

StartCountdown()
// Manually triggers the countdown sequence.
// Useful if you want to start the closing process programmatically.
closeButtonAdvanced1.StartCountdown();
StopCountdown()
// Cancels any active countdown and resets the visual state.
closeButtonAdvanced1.StopCountdown();
ProcessCloseShortcut(Keys keyData)
// Processes a key press to check if it matches the ShortcutKey.
// Should be called from the parent form's ProcessCmdKey or KeyDown event.
// Returns true if the shortcut was processed.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
                if (siticoneCloseButtonAdvanced1.ProcessCloseShortcut(keyData))
                return true;
                return base.ProcessCmdKey(ref msg, keyData);
}

Events

CountdownTick
// Fired every second during the countdown.
// 'e.RemainingSeconds' gives the current time left.
closeButton.CountdownTick += (sender, e) =>
{
    statusLabel.Text = $"Closing in {e.RemainingSeconds}...";
                // You can cancel the tick via logic if needed
                if (userIsActive) e.IsCancelled = true;
};
CountdownComplete
// Fired when the countdown hits zero, just before the form action is taken.
closeButton.CountdownComplete += (sender, e) =>
{
                SaveUserData();
                Logger.Log("Application closed via countdown.");
};
Lifecycle Events
// CountdownStarted: Fired when countdown begins.
closeButton.CountdownStarted += (s, e) => Debug.WriteLine("Timer Started");

// CountdownCanceled: Fired if user stops it (e.g. second click).
closeButton.CountdownCanceled += (s, e) => Debug.WriteLine("Timer Stopped");

// ButtonClick: Fired on click, indicating if countdown is active.
closeButton.ButtonClick += (s, e) => 
{
                if (e.IsCountdownActive) Debug.WriteLine("Clicked while counting down");
};

Designer & Smart Tags

The control includes a comprehensive Smart Tag panel for rapid setup.

Category Features
Quick Configurations Immediate Close: Disables countdowns.
Standard Countdown: Sets a 3s delay.
Minimize Action: Switches behavior to minimize window.
Themes Material Design: Enables spinner animation.
Bold Warning: High-visibility red/yellow styling.
Corporate: Professional blue/grey palette.
Accessibility: High contrast settings.
Animations Toggles for Full Animation (Spinners + Fade) or Minimal Animation (Simple progress ring).

Detailed Examples

Example 1: Preventing Accidental Closure

Integrate with the form to intercept Alt+F4 and force a countdown, giving users a chance to cancel.

C# - Forced Countdown
public void SetupForcedCountdown()
{
                // 1. Intercept standard form closing (Alt+F4, X button)
    btnClose.IntegrateWithFormClosing = true;
    
                // 2. Set Countdown behavior
    btnClose.CountdownMode = true;
    btnClose.CountdownSeconds = 3;
    btnClose.CancelOnSecondClick = true;
    
                // 3. Handle events
    btnClose.CountdownStarted += (s, e) => lblStatus.Text = "Closing...";
    btnClose.CountdownCanceled += (s, e) => lblStatus.Text = "Resumed";
}

Example 2: Material Design Theme with Sound

Configuring the control to look like a modern material loader with audio feedback.

C# - Material Style
private void ApplyMaterialStyle()
{
    btnClose.IconColor = Color.Gray;
    btnClose.CountdownColor = Color.DodgerBlue;
    
                // Material Animation Settings
    btnClose.AnimationStyle = AdvancedCloseButtonAnimationType.MaterialIndicator;
    btnClose.MaterialIndicatorSegments = 12;
    btnClose.MaterialRotationSpeed = 15f;
    btnClose.MaterialIndicatorThickness = 3;
    
                // Sound
    btnClose.EnableSounds = true;
    btnClose.CountdownTickSound = "Tick";
    
                // Hide text for a cleaner icon-only look during countdown
    btnClose.ShowCountdownText = false;
}

Example 3: Manual Shortcut Integration

Implementing a global keyboard shortcut to trigger the button.

C# - Keyboard Shortcut
// In the parent Form
public MainForm()
{
                InitializeComponent();
    btnClose.ShortcutKey = Keys.Escape;
}

// Override ProcessCmdKey to handle the shortcut
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
                // Forward the key press to the close button
                // Returns true if the button handled it (started/stopped countdown)
                if (btnClose.ProcessCloseShortcut(keyData))
                return true;
        
                return base.ProcessCmdKey(ref msg, keyData);
}