Susan Harkins
ssharkins at bellsouth.net
Sat Aug 14 19:00:30 CDT 2004
Well, I hadn't even considered an API. ;) Thank you Stuart -- I'll take a look. Susan H. On 14 Aug 2004 at 18:01, Susan Harkins wrote: > Is there a generic color palette control? I'd like to just display one > automatically on a form. Or, if I must, I don't mind displaying the > built-in palette -- but I can't figure out how to call it. For my > purposes, I think a fixed control would be better. > The ChooseColor common dialog. If the user clicks the OK button of the dialog box, the return value is nonzero. The rgbResult member of the CHOOSECOLOR structure contains the RGB color value of the color selected by the user. Here's some sample code from APIGuide which you can get from http://www.allapi.net (Note that they don't use Hungarian and use i as a loopcounter but I can still follow their code <grin>) Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long 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 Dim CustomColors() As Byte 'Redim the variables to store the cutstom colors ReDim CustomColors(0 To 16 * 4 - 1) As Byte Dim i As Integer For i = LBound(CustomColors) To UBound(CustomColors) CustomColors(i) = 0 Next i Private Function ShowColor() As Long Dim cc As CHOOSECOLOR Dim Custcolor(16) As Long Dim lReturn As Long 'set the structure size cc.lStructSize = Len(cc) 'Set the owner cc.hwndOwner = Me.hwnd 'set the application's instance cc.hInstance = App.hInstance 'set the custom colors (converted to Unicode) cc.lpCustColors = StrConv(CustomColors, vbUnicode) 'no extra flags cc.flags = 0 'Show the 'Select Color'-dialog If CHOOSECOLOR(cc) <> 0 Then ShowColor = cc.rgbResult CustomColors = StrConv(cc.lpCustColors, vbFromUnicode) Else ShowColor = -1 End If End Function -- Stuart -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com