Slider Customization in Windows Forms Toggle Button

29 Apr 20211 minute to read

In the Toggle Button, the Slider is used to switch between two different states. It can be customized with different colors by using the Color property. The height of the Slider is calculated based on the Control’s Height. The Slider Width is customized by using the Slider.Width property that should not exceed the control’s width.

this.toggleButton1.Slider.BorderColor = Color.Transparent;
this.toggleButton1.Slider.ForeColor = Color.Blue;
this.toggleButton1.Slider.HoverColor = Color.White;    
this.toggleButton1.Slider.BackColor = Color.White;            
this.toggleButton1.Slider.Width = 30;
Me.ToggleButton1.Slider.BorderColor = Color.Transparent
Me.ToggleButton1.Slider.ForeColor = Color.Blue
Me.ToggleButton1.Slider.HoverColor = Color.White
Me.ToggleButton1.Slider.BackColor = Color.White
Me.ToggleButton1.Slider.Width = 30

Customization of slider width