![]() ![]() | ||
Everyone who uses Windows knows about buttons. I presented an overview of buttons in the In Depth section of this chapter—now for more of the individual details. Like other Windows controls, the Button class is based on the Control class. In fact, the Button class is based directly on the ButtonBase class, which is also the base class for other types of buttons; here's the class hierarchy for Button:
Object MarshalByRefObject Component Control ButtonBase Button
You can find the more notable public properties of the Button class in Table 6.1 and the more notable methods in Table 6.2, including those inherited from the ButtonBase class. Note that as with other Windows controls, I am not listing the notable properties, methods, and events Button inherits from the Control class, such as the Click event—you can see all that in Chapter 5, Tables 5.1, 5.2, and 5.3.
Property |
Means |
---|---|
DialogResult |
Gets/sets the value returned to the parent form when the button is clicked. Often used when you're creating dialog boxes. |
FlatStyle |
Gets/sets a flat style appearance. |
Image |
Gets/sets an image displayed in a button. |
ImageAlign |
Gets/sets the alignment of the image in a button. |
ImageIndex |
Gets/sets the image list index value of the image displayed in the button. |
ImageList |
Gets/sets the ImageList that contains the images displayed in a button. |
TextAlign |
Gets/sets the alignment of the text in the button. |
Method |
Means |
---|---|
PerformClick |
Causes a Click event for a button. |
![]() ![]() | ||