ShowCustomColorDialog Event

Description

Occurs while user shows a custom color dialog.

Syntax

Sub ctlname_ShowCustomColorDialog (Long hParentWnd, Bool bReturn)

Remarks

This event occurs when before user clicks custom item button to browse color, generally, this time Windows Color Dialog will show up, if you hope self custom color dialog replaces the dialog, can place code here to show your color dialog and output selected color value to the control.

hParenrWnd is your custom dialog parent window handle, bReturn determines whether the control build-in Windows Color Dialog will show up continually.

Sample

'In Form1 dialog

Private Sub ColorPicker1_ShowCustomColorDialog(ByVal hParentWnd As Long, bReturn As Boolean)

ColorPicker1.HidePopup    'Because the control popup window always topmost, hide it.

ColorDialog.Show vbModal

bReturn = True    'sets to True do not show built-in Windows Color Dialog up

End Sub

'OK button click event code in custom Color Dialog

Private Sub OKBtn_Click()

Form1.ColorPicker1.Value = GetValue()    'Private Get value function

Unload Me

End Sub