Page 53 - Open Soource Technologies 304.indd
P. 53
Unit 3: Understanding Controls and Control Events
3.4.4.1 Properties of Command Button
BackColor
Sets the color of the Command Button's background. This property only takes effect when the
Style property is set to 1 - Graphical.
Cancel
If this property is set to True, pressing the Escape key at runtime will activate the Command
Button's Click event. Only one Command Button on the Form can have this property set to True.
Caption
Sets the text to be displayed on the Command Button.
If possible keep this as short as possible, so you don't have to resize the Command Button. You
can always use the ToolTipText property if you want to give the user further information.
You can use mnemonics e.g. putting the '&' symbol somewhere in the Caption will cause the
following character to be underlined at runtime. When the user presses the Alt+[Underlined
Letter] key combination, the Command Button's Click event will be called.
Default
Works in a similar way to the cancel property, but with the Enter key. The Command Button,
which has this property set to True, will also appear with a darker border.
Disabled Picture
Sets the picture to be displayed when the enabled property is set to False. The Style property
must be set to 1-Graphical.
Figure 3.12: Using the Disabled Picture Property.
LOVELY PROFESSIONAL UNIVERSITY 47