- 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()
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.
Preferable reference for this tutorial is
Teknomo, Kardi. Visual Basic Tutorial . http:\\people.revoledu.com\kardi\ tutorial\VB