I'd like to add a color palette to my form, so that the user can choose a color. How can I add such a palette to my form(with all the colors vb offers)?

Hi,
Add this Control to ur ToolBox:
"Microsoft Commom Dialog Control 6.0" to ur Project. Place the Control on the Form and rename it as "cdlg"
and use this Code:

Private Sub Command1_Click()
    Dim mycol
    cdlg.ShowColor
    mycol = cdlg.Color
    Me.BackColor = mycol
End Sub

Regards
Veena

Two questions
1. I'd like to also add the system colors
2. How to move the palette to a certain place on the screen?

Hi,

U cannot Control the position of CommonDialog control. But there is an alternative, Place the common Dialog on a New Form, and Move the Form to Desired position on Screen and Show the Form.

Some thing like this : Add a Form And Rename it as frmColor:

Dim frmColor As New frmColor
 frmColor.Move 200,500
 frmColor.cdlg.ShowColor

Not very sure abt system colors...

Regards
Veena

Thanks,works great

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.