Kardi Teknomo
Kardi Teknomo Kardi Teknomo Kardi Teknomo
     
 
Research
Publications
Tutorials
Resume
Personal
Resources
Contact

 


Change the Drawing Color

<Previous lesson | Table of Content | Content of this Chapter | Next lesson>

Click here to download the code

  1. 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
  2. Drag and drop the Common Dialog control into frmController.
  3. 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).
  4. Double click the cmdColor and add code below

    Private Sub cmdColor_Click()

    CommonDialog1.ShowColor
    cmdColor.BackColor = CommonDialog1.color
    frmMap.MYCOLOR = cmdColor.BackColor
    End Sub

    Remember that we have declared public variable MYCOLOR in frmMap.

  5. 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 lesson | Table of Content | Content of this Chapter | Next lesson>

 
 
© 2006 Kardi Teknomo. All Rights Reserved.
Designed by CNV Media