Dialog - color - using API
The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.
'API dialogs for file selections and color selections
Private Type CHOOSECOLOR
lStructSize As Long
hwndOwner As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Declare Function ChooseColorAPI Lib "comdlg32.dll" Alias _
"ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long
Sub SelectColor()
Dim CustomColors() As Byte
Dim cc As CHOOSECOLOR
Dim Custcolor(16) As Long
Dim iReturn As Long
cc.lStructSize = Len(cc)
cc.hwndOwner = frmMain.hwnd
cc.hInstance = 0
cc.lpCustColors = StrConv(CustomColors, vbUnicode)
cc.Flags = 0
iReturn = ChooseColorAPI(cc)
If iReturn <> 0 Then
lblBackgroundColor.BackColor = cc.rgbResult
End If
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.