G
Guest
Is there a buildin combobox with color pallet
so I can choose a color and it value save in a another field
so I can choose a color and it value save in a another field
Paolo said:Hi Liora,
You can call the windows color palette.
I don't remember where I found this code but it works great.
Add to a module this code
Private Type COLORSTRUC
lStructSize As Long
hwnd 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 Const CC_SOLIDCOLOR = &H80
Private Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" _
(pChoosecolor As COLORSTRUC) As Long
Public Function DialogColor() As Long
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long
CS.lStructSize = Len(CS)
CS.hwnd = hWndAccessApp
CS.Flags = CC_SOLIDCOLOR
CS.lpCustColors = String$(16 * 4, 0)
x = ChooseColor(CS)
DialogColor = CS.rgbResult
End Function
then create a button in your form and add this code to the on click event
selected_color = DialogColor()
So when you click the button you open the color palette of window and the
choosen color is returned in the variable selected_color.
HTH Paolo