HypernovaDesktop Components · docs
Binarymission
WinFormsToggle Check Button › ToggleSwitch

ToggleSwitch

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.ToggleControls

A check box drawn as a sliding switch, in the style used by modern desktop and mobile platforms, with an optional rounded border.

public class ToggleSwitch : Control

Inherits from / implements: Control

Remarks

This is a thin public shell. Every appearance property is forwarded to an internal ToggleCheckButton, which is what actually composes and paints the switch. The separation exists so the public surface can stay small and stable while the interior is free to change.

Members at a glance

ToggleSwitchInitializes a new instance of the ToggleSwitch class.
BorderColorGets or sets the color of the border.
CheckedStateBackColorGets or sets the back-color of the checked state.
CheckedStateImageGets or sets the checked state image.
CheckedTextGets or sets the checked state text.
GradientColorGets or sets the colour the moving part's vertical gradient starts from.
IsCheckedGets or sets a value indicating whether this instance is checked.
OnHoverBackColorGets or sets the back color for the hover.
ShouldDrawBorderGets or sets a value indicating whether the control should draw border.
ShouldUseImageForCheckedStateGets or sets a value indicating whether the control should use image for checked state.
UnCheckedStateBackColorGets or sets the back-color of the unchecked state.
UnCheckedStateImageGets or sets the unchecked state image.
UnCheckedTextGets or sets the unchecked state text.
OnGotFocus
OnKeyUp
OnLostFocus
OnPaint
OnResize
OnSizeChanged
IsCheckedChangedOccurs when the control's IsChecked property changes.

Constructors

ToggleSwitch

public ToggleSwitch()

Initializes a new instance of the ToggleSwitch class.

Properties

BorderColor

public Color BorderColor

Gets or sets the color of the border.

CheckedStateBackColor

public Color CheckedStateBackColor

Gets or sets the back-color of the checked state.

CheckedStateImage

public Bitmap CheckedStateImage

Gets or sets the checked state image.

Value. The checked state image.

CheckedText

public string CheckedText

Gets or sets the checked state text.

GradientColor

public Color GradientColor

Gets or sets the colour the moving part's vertical gradient starts from.

Value. The colour of the gradient.

IsChecked

public bool IsChecked

Gets or sets a value indicating whether this instance is checked.

OnHoverBackColor

public Color OnHoverBackColor

Gets or sets the back color for the hover.

ShouldDrawBorder

public bool ShouldDrawBorder

Gets or sets a value indicating whether the control should draw border.

ShouldUseImageForCheckedState

public bool ShouldUseImageForCheckedState

Gets or sets a value indicating whether the control should use image for checked state.

When true , CheckedStateImage and UnCheckedStateImage are shown in place of CheckedText and UnCheckedText.

UnCheckedStateBackColor

public Color UnCheckedStateBackColor

Gets or sets the back-color of the unchecked state.

UnCheckedStateImage

public Bitmap UnCheckedStateImage

Gets or sets the unchecked state image.

Value. The unchecked state image.

UnCheckedText

public string UnCheckedText

Gets or sets the unchecked state text.

Methods

OnGotFocus

protected override void OnGotFocus(EventArgs e)

No summary in the source yet.

OnKeyUp

protected override void OnKeyUp(KeyEventArgs e)

No summary in the source yet.

OnLostFocus

protected override void OnLostFocus(EventArgs e)

No summary in the source yet.

OnPaint

protected override void OnPaint(PaintEventArgs e)

No summary in the source yet.

OnResize

protected override void OnResize(EventArgs e)

No summary in the source yet.

OnSizeChanged

protected override void OnSizeChanged(EventArgs e)

No summary in the source yet.

Events

IsCheckedChanged

public event EventHandler IsCheckedChanged

Occurs when the control's IsChecked property changes.