Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ToggleButton in C# WinForms

Is it possible to create a toggle button in C# WinForms? I know that you can use a CheckBox control and set it's Appearance property to "Button", but it doesn't look right. I want it to appear sunken, not flat, when pressed. Any thoughts?

like image 380
Jon Tackabury Avatar asked Nov 11 '08 20:11

Jon Tackabury


People also ask

What is ToggleButton How do you create it explain with example?

A toggle button allows the user to change a setting between two states. You can add a basic toggle button to your layout with the ToggleButton object. Android 4.0 (API level 14) introduces another kind of toggle button called a switch that provides a slider control, which you can add with a Switch object.

What is toggle view?

Toggle refers to the act of switching from one view, setting, or function to another. It implies that there are only two possible options and that a user is switching between them, and usually these options are on or off for a specific preference.


1 Answers

You can just use a CheckBox and set its appearance to Button:

CheckBox checkBox = new System.Windows.Forms.CheckBox();  checkBox.Appearance = System.Windows.Forms.Appearance.Button;  
like image 142
Simon Sabin Avatar answered Oct 08 '22 19:10

Simon Sabin