ToggleButton in C# WinForms

Jon Tackabury picture Jon Tackabury · Nov 11, 2008 · Viewed 128k times · Source

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?

Answer

Simon Sabin picture Simon Sabin · Sep 23, 2010

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;