Class ToggleButton
Represents a control that displays the text and image in a style format.
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public class ToggleButton : BaseControl, IThemeProvider, IVisualStyle, IDisposable, ISupportInitialize
Remarks
The ToggleButton control for Windows Forms allows you to toggle between two states (Active and Inactive) that are opposite to each other in terms of behavior.
Constructors
ToggleButton()
Initialize a new instance of the ToggleButton component and sets its default.
Declaration
public ToggleButton()
Fields
t_Initializing
Gets or Sets the initializing stage of toggleButton.
Declaration
protected bool t_Initializing
Field Value
| Type |
|---|
| System.Boolean |
Properties
ActiveState
Gets or sets the ActiveState values for ToggleButton.
Declaration
public ActiveStateCollection ActiveState { get; set; }
Property Value
| Type |
|---|
| ActiveStateCollection |
BackColor
Gets or sets the BackColor of the control.
Declaration
public override Color BackColor { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color |
BackgroundImage
Gets or sets the BackGroundImage of the control.
Declaration
public override Image BackgroundImage { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Image |
BackgroundImageLayout
Gets or sets the BackgroundImageLayout of the control.
Declaration
public override ImageLayout BackgroundImageLayout { get; set; }
Property Value
| Type |
|---|
| System.Windows.Forms.ImageLayout |
DefaultSize
Declaration
protected override Size DefaultSize { get; }
Property Value
| Type |
|---|
| System.Drawing.Size |
DisplayMode
Gets or sets the DisplayType of the ToggleButton.
Declaration
public DisplayType DisplayMode { get; set; }
Property Value
| Type |
|---|
| DisplayType |
Font
Gets or sets the System.Drawing.Font value for the control.
Declaration
public override Font Font { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Font |
ForeColor
Gets or sets the ForeColor of the control.
Declaration
public override Color ForeColor { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color |
InactiveState
Gets or sets the InactiveState values for ToggleButton.
Declaration
public InactiveStateCollection InactiveState { get; set; }
Property Value
| Type |
|---|
| InactiveStateCollection |
Renderer
Gets or sets the Renderer for Toggle Button.
Declaration
public IToggleButtonRenderer Renderer { get; set; }
Property Value
| Type |
|---|
| IToggleButtonRenderer |
Slider
Gets or sets the Slider values for ToggleButton.
Declaration
public SliderCollection Slider { get; set; }
Property Value
| Type |
|---|
| SliderCollection |
ThemeStyle
Gets or sets the ToggleButtonVisualStyle value used to customize the appearance of the ToggleButton.
Declaration
public ToggleButtonVisualStyle ThemeStyle { get; set; }
Property Value
| Type |
|---|
| ToggleButtonVisualStyle |
Remarks
This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.
ToggleState
Gets or sets the ToggleButtonState.
Declaration
public ToggleButtonState ToggleState { get; set; }
Property Value
| Type |
|---|
| ToggleButtonState |
VisualStyle
Gets or sets the visual style for the ToggleButton.
Declaration
public ToggleButtonStyle VisualStyle { get; set; }
Property Value
| Type |
|---|
| ToggleButtonStyle |
Methods
BeginInit()
Signals the object that initialization is starting.
Declaration
public void BeginInit()
Dispose(Boolean)
Clean up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing | true if managed resources should be disposed; otherwise, false. |
EndInit()
Signals the object that initialization is complete.
Declaration
public void EndInit()
GetControlName(String)
Helps to apply the ControlName settings in control
Declaration
public override string GetControlName(string controlName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | controlName |
Returns
| Type |
|---|
| System.String |
Overrides
OnEnabledChanged(EventArgs)
Raises the System.Windows.Forms.Control.EnabledChanged event.
Declaration
protected override void OnEnabledChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e | An System.EventArgs that contains the event data. |
OnHandleCreated(EventArgs)
Declaration
protected override void OnHandleCreated(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnKeyDown(KeyEventArgs)
Raises when key down is performed
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.KeyEventArgs | e | EventArgs that contains the event data. |
OnMouseEnter(EventArgs)
Overrides the Mouse enter method
Declaration
protected override void OnMouseEnter(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e | Event data |
OnMouseLeave(EventArgs)
Overrides the Mouse leave method
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e | Event Data |
OnMouseMove(MouseEventArgs)
Overrides the Mouse up method
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e | Event Data |
OnMouseUp(MouseEventArgs)
Overrides the Mouseup method
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e | Event data |
OnPaint(PaintEventArgs)
Overrides the Paint Method
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.PaintEventArgs | e | Event data |
OnParentChanged(EventArgs)
Declaration
protected override void OnParentChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnThemeNameChanged(String)
Helps to apply the ThemeName settings in control
Declaration
public override void OnThemeNameChanged(string themeName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | themeName | ThemeName |
Overrides
OnToggleStateChanged(ToggleStateChangedEventArgs)
Raises the ToggleStateChanged event.
Declaration
protected virtual void OnToggleStateChanged(ToggleStateChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| ToggleStateChangedEventArgs | e | The System.EventArgs instance containing the event data. |
OnToggleStateChanging(CancelEventArgs)
Raises the ToggleStatechanging event.
Declaration
protected virtual void OnToggleStateChanging(CancelEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ComponentModel.CancelEventArgs | e | The System.EventArgs instance containing the event data. |
SwitchState()
Swaps the ToggleState of the ToggleButton.
Declaration
public void SwitchState()
Events
ToggleStateChanged
Occurs after the ToggleState property changed in ToggleButton.
Declaration
public event ToggleStateChangedEventHandler ToggleStateChanged
Event Type
| Type |
|---|
| ToggleStateChangedEventHandler |
Remarks
This event occurs after the ToggleStateChanging event if that event is not cancelled.
ToggleStateChanging
Occurs when the ToggleState property is changing in ToggleButton.
Declaration
public event CancelEventHandler ToggleStateChanging
Event Type
| Type |
|---|
| System.ComponentModel.CancelEventHandler |
Remarks
You can customize the ToggleState process through System.ComponentModel.CancelEventHandler event argument.