Private Sub Form_Click()
BackColor = SelectColor
End Sub
Модуль Name="APISelectColor"
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
Public Function SelectColor() As Long
Dim Z As Long
Dim Cc As CHOOSECOLOR
Dim CustomColors() As Byte
ReDim CustomColors(0 To 16 * 4 - 1) As Byte
For Z = LBound(CustomColors) To UBound(CustomColors)
CustomColors(Z) = 255 ' белый
Next Z
With Cc
.lStructSize = Len(Cc)
.hwndOwner = mhOwner
.hInstance = App.hInstance
.lpCustColors = getonv(CustomColors, vbUnicode)
Z = ChooseColorAPI(Cc)
If Z > 0 Then SelectColor = .rgbResult
End With
End Function |
|