< Previous | Next | VB Tutorial | Contents >
VB Color
- In the Toolbox, Right click and a pop up menu will be shown. You choose Components. A dialog window will appear. In the control Tab of the dialog, scroll down and find Microsoft Common Dialog Control. Check the Checkbox and press OK. See that the Common Dialog control is added to your toolbox
- Drag and drop the Common Dialog control into frmController.
- Add CommandButton inside Frame1 in the frmController, change the Name property into cmdColor. Change the Style property into Graphical. Change the BackColor property into any color you want. Delete the Caption property (make it empty).
- Double click the cmdColor and add code below
Private Sub cmdColor_Click()
CommonDialog1.ShowColor
End Sub
cmdColor.BackColor = CommonDialog1.color
frmMap.MYCOLOR = cmdColor.BackColor
Remember that we have declared public variable MYCOLOR in frmMap.
-
Now run the program and draw manually. Change
the color of the cmdColor in frmController and see what happen to
the drawing color in frmMap.
< Previous | Next | VB Tutorial | Contents >
Rate this tutorial or give your comments about this tutorial
Preferable reference for this tutorial is
Teknomo, Kardi. Visual Basic Tutorial . https:\\people.revoledu.com\kardi\ tutorial\VB