Graphical Style of OptionButton and CheckBox Controls


This lesson gives you a short description about the graphical style property of the OptionButton and CheckBox controls. This feature gives a graphical flavor to these controls. Its use has been demonstrated through sample programs.

This new interesting feature was introduced by Visual Basic 5.


Before proceeding you must have the knowledge of the previous lessons:




Graphical Style of OptionButton

The OptionButton Control comes with a graphical style. First of all, you have to set its Style property to 1-Graphical. Doing so, the appearance of the control changes. The appearance becomes modern as well as graphical from its old fashioned style. Notice that a thin border around the control is drawn. After setting its Style property to 1-Graphical, it looks like the CommandButton control but works as an OptionButton. Set a picture to the OptionButton control using the Picture property. Choose a suitable icon for the control. You may assign a picture to the DownPicture property for the down state of the option button control. You may assign another picture or icon to the DisabledPicture property for the Disabled state of the control as well. 

The following sample program teaches you how to use graphical option buttons in your application.



Graphical Style of CheckBox 

The CheckBox Control also comes with a graphical style. You need to set the Style property to 1. The appearance of the controls becomes graphical. Now set an image from the Picture property.

You may also assign pictures to the DownPicture and the DisabledPicture properties for the down state and disabled states respectively.
 

The sample program Restaurant Order 2 shows you how to use graphical checkbox.


Whenever you are using the Graphical style, remember that they do not loose their efficiency, meaning that an option button, when pressed, stays in the down state and other option buttons stay in the up state. And the in case of the CheckBox control, setting the Style property to Graphical does not loose their efficiency too. You can have multiple checkboxes pressed at the same time. In fine, the original meaning of the controls remain the same.

The graphical style of these controls makes a simple program interesting. So it is recommended to use it whenever it is appropriate.