Thursday, March 17, 2011

How to Make My Own Visual Basic Command Buttons


Creating a Command Button Image
1. Load up your favorite image editor and create a box shape. Select the box icon and drag and extend the box tool until you create a rectangle.
2. Insert whatever text you feel completely describes the button's nature. Select the text tool icon and select an area with the mouse in which you wish to outlay text. Type the text you wish into the text box.
3. Create three instances of this button image. One of the instances must be when the button is not pressed down and is selectable. Another instance is called the down state, and this image shows when the button has been pressed or clicked on. The last instance is the disabled instance and only occurs when this button is visible but not selectable or click-able. To create these instances just create a different image file for each button graphic.
4. Edit the graphic slightly for each instance and save each graphic separately. 'Button,' 'down button' and 'disabled button' are three potential names for the image files. After you're finished creating imaging, you should have a total of three image files: one for the regular display, one for when the button is held down and one for when the button is disabled.
Adding the Command Button to Visual Basic
5. Load up Microsoft Visual Basic and then right-click the form in the navigation panel and go to Design View.
6. Click the button icon that is in the design tab under the control group.
7. Click the command button icon and drag the mouse over the form to create a box. After drawing the button on the form, click the the button and go to the Properties menu.
8. Click the picture attribute in Properties and select the first image instance of the button in its normal state.
9. Click the down-picture attribute in Properties and select the second image instance of the button in its down state.
10. Click the disabled picture attribute in Properties and select the third image instance of the button in its disabled state.
11. Click the play button icon at the top of the toolbar to run the form and check to see if the buttons work.