Displays the CommDlg control's Color dialog box.
CommDlg.ShowColor
CommDlg.Color [ = rgb% ]
CommDlg.Colors(0..15) [ = rgb% ]
The Color property returns or sets the selected color.
If the cdcRgbInit flag is set, the value set with Color specifies the color initially selected when the dialog box is created. If the specified color value is not among the available colors, the system selects the nearest solid color available. If Color is zero or cdcRgbInit is not set, the initially selected color is black. If the user clicks the OK button, Color specifies the user's color selection.
The Colors(0..15) property is an array of integers of 16 RGB color values that contain red, green, blue (RGB) values for the custom color boxes in the dialog box.
The Flags property can be used to set the options for a Color dialog box.
cdcFullOpen (2) | Entire dialog box is displayed, including the Define Custom Colors section. |
cdcShowHelp (8) | Causes the dialog box to display a Help button. |
cdcPreventFullOpen (4) | Disables the Define Custom Colors command button and prevents the user from defining custom colors. |
cdcRgbInit (1) | Sets the initial color value for the dialog box. |
cdcSolidColor (128) | Causes the dialog box to display only solid colors in the set of basic colors. |
cdcAnyColor (256) | Causes the dialog box to display all available colors in the set of basic colors. |
Ocx CommDlg cd
Dim i As Int
For i = 0 To 15
cd.Colors(i) = QBColor(i) //custom colors
Next
cd.Color = colBtnFace
cd.Flags = cdcRgbInit | cdcShowHelp
cd.CancelError = True
cd.ShowColor
Sub cd_OnHelp
Me.Caption = "Help Requested"
EndSub
EndSub
{Created by Sjouke Hamstra; Last updated: 23/10/2014 by James Gaite}