Nov 19, 2008

Button, Button, Whose Got the Button?

When using the Visual Studio 2008 IDE one does tend to become very dependent upon the visible list of Properties for toolbox items that are dragged onto a form.  I often just scan the available properites and read the little help information that shows up in the bottom of the exploreer to figure out how to do something rather than searching throught the byzantine maze of hyperlinked documentation that Microsoft passes off as a manual. It just ends up being faster. However, when an object has a property that hasn't been exposed to the visual designer it easy to think the feature you are after isn't supported. 
This happened recently while I was using radio buttons. I wanted them to behave like buttons I used to use in C++ Builder, that is I wanted them to look like actual buttons and to be sticky. This is useful when you have a tool palette that has a series of mutually exclusive operations. You click on the button for the function you desire, the button takes on a down appearance and it is obvious to the user what mode they are in.  There is no way to do this form the Properties explorer. However, in code you can do the following:

RadioButton btn = new RadioButton();

btn.Appearance = Appearance.Button;

About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.