HypernovaDesktop Components · docs
Binarymission
WinFormsToggle Check Button › Win8ToggleSwitch

Win8ToggleSwitch

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

A check box drawn as a sliding switch in the modern Windows style: a rectangular track with an outer and an inner border, a gradient-filled interior, and a solid stick that sits at the left or the right end according to the state.

public class Win8ToggleSwitch : Control

Inherits from / implements: Control

Remarks

Every part is drawn by this control rather than composed from child controls, and each part has an independent colour for the checked and unchecked states, so the switch can be themed to match a host application without subclassing. Painting goes through an off-screen buffer. The drawing is a sequence of overlapping rectangles, and painting those straight to the screen produces visible tearing while the pointer moves across the control.

Members at a glance

Win8ToggleSwitchInitializes a new instance of the Win8ToggleSwitch class.
BackgroundEndColorGets or sets the end color of the background.
BackgroundEndColorUncheckedGets or sets the background end color for the unchecked state.
BackgroundStartColorGets or sets the start color of the background.
BackgroundStartColorUncheckedGets or sets the background start color for the unchecked state.
InnerBorderColorGets or sets the color of the inner border.
InnerBorderColorUncheckedGets or sets the inner border color for the unchecked state.
InnerBorderThicknessGets or sets the inner border thickness.
IsCheckedGets or sets a value indicating whether this instance is checked.
OuterBorderColorGets or sets the color of the outer border.
OuterBorderColorUncheckedGets or sets the outer border color for the unchecked state.
OuterBorderThicknessGets or sets the outer border thickness.
ShouldDrawFocusRectangleWhenFocusedGets or sets a value indicating whether the control should draw focus rectangle when focused.
ShouldDrawGapBetweenSwitchStickAndTrackGets or sets a value indicating whether the control should draw gap between switch-stick and the track.
SwitchStickControlGapWidthGets or sets the width of the switch-stick control gap.
ToggleStickColorGets or sets the color of the toggle stick.
ToggleStickColorUncheckedGets or sets the toggle stick color for its unchecked state.
ToggleSwitchStickWidthGets or sets the width of the toggle switch-stick.
Dispose
OnGotFocus
OnHandleCreated
OnKeyDown
OnKeyUp
OnLostFocus
OnMouseEnter
OnMouseLeave
OnMouseUp
OnPaint
OnParentChanged
ToggledOccurs when the switch has been toggled.

Constructors

Win8ToggleSwitch

public Win8ToggleSwitch()

Initializes a new instance of the Win8ToggleSwitch class.

Properties

BackgroundEndColor

public Color BackgroundEndColor

Gets or sets the end color of the background.

BackgroundEndColorUnchecked

public Color BackgroundEndColorUnchecked

Gets or sets the background end color for the unchecked state.

BackgroundStartColor

public Color BackgroundStartColor

Gets or sets the start color of the background.

BackgroundStartColorUnchecked

public Color BackgroundStartColorUnchecked

Gets or sets the background start color for the unchecked state.

InnerBorderColor

public Color InnerBorderColor

Gets or sets the color of the inner border.

InnerBorderColorUnchecked

public Color InnerBorderColorUnchecked

Gets or sets the inner border color for the unchecked state.

InnerBorderThickness

public int InnerBorderThickness

Gets or sets the inner border thickness.

IsChecked

public bool IsChecked

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

OuterBorderColor

public Color OuterBorderColor

Gets or sets the color of the outer border.

OuterBorderColorUnchecked

public Color OuterBorderColorUnchecked

Gets or sets the outer border color for the unchecked state.

OuterBorderThickness

public int OuterBorderThickness

Gets or sets the outer border thickness.

ShouldDrawFocusRectangleWhenFocused

public bool ShouldDrawFocusRectangleWhenFocused

Gets or sets a value indicating whether the control should draw focus rectangle when focused.

ShouldDrawGapBetweenSwitchStickAndTrack

public bool ShouldDrawGapBetweenSwitchStickAndTrack

Gets or sets a value indicating whether the control should draw gap between switch-stick and the track.

SwitchStickControlGapWidth

public int SwitchStickControlGapWidth

Gets or sets the width of the switch-stick control gap.

ToggleStickColor

public Color ToggleStickColor

Gets or sets the color of the toggle stick.

ToggleStickColorUnchecked

public Color ToggleStickColorUnchecked

Gets or sets the toggle stick color for its unchecked state.

ToggleSwitchStickWidth

public int ToggleSwitchStickWidth

Gets or sets the width of the toggle switch-stick.

Methods

Dispose

protected override void Dispose(bool disposing)

No summary in the source yet.

OnGotFocus

protected override void OnGotFocus(EventArgs e)

No summary in the source yet.

OnHandleCreated

protected override void OnHandleCreated(EventArgs e)

No summary in the source yet.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs 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.

OnMouseEnter

protected override void OnMouseEnter(EventArgs e)

No summary in the source yet.

OnMouseLeave

protected override void OnMouseLeave(EventArgs e)

No summary in the source yet.

OnMouseUp

protected override void OnMouseUp(MouseEventArgs e)

No summary in the source yet.

OnPaint

protected override void OnPaint(PaintEventArgs pe)

No summary in the source yet.

OnParentChanged

protected override void OnParentChanged(EventArgs e)

No summary in the source yet.

Events

Toggled

public event EventHandler Toggled

Occurs when the switch has been toggled.