Autoit3 Library – ColorChooser
Informatie (ENG)
This ColorChooser library provides a dialog box to select a color in three color models – RGB (Red, Green, Blue), HSL (Hue, Saturation, Lightness), and HSB (Hue, Saturation, Brightness). This is not a program, this is a function that you can use in your scripts. This function is similar to the _ChooseColor() from Misc UDF library that is included in the AutoIt package. UDF is fully compatible with ColorPicker UDF (v1.5) and can be used as a custom function for a Color Chooser dialog box (see examples). Also there is a tool (pipette) to get the color from the screen. I recommend to first read description inside the library. Please play with this UDF and post any comments and suggestions.
Voorbeeld scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#Include <ColorChooser.au3> Opt('MustDeclareVars', 1) Global $hForm, $Msg, $Label, $Button, $Data, $Color = 0x50CA1B $hForm = GUICreate('MyGUI', 170, 200) $Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN) GUICtrlSetBkColor(-1, $Color) $Button = GUICtrlCreateButton('Select color...', 35, 166, 100, 23) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button $Data = _ColorChooserDialog($Color, $hForm) If $Data > -1 Then GUICtrlSetBkColor($Label, $Data) $Color = $Data EndIf EndSwitch WEnd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#Include <ColorChooser.au3> #Include <ColorPicker.au3> Opt('MustDeclareVars', 1) Global $hForm, $Msg, $Label, $Picker $hForm = GUICreate('MyGUI', 170, 200) $Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN) GUICtrlSetBkColor(-1, 0x50CA1B) $Picker = _GUIColorPicker_Create('', 55, 166, 60, 23, 0x50CA1B, BitOR($CP_FLAG_CHOOSERBUTTON, $CP_FLAG_MAGNIFICATION, $CP_FLAG_ARROWSTYLE), 0, -1, -1, 0, 'Simple Text', 'Custom...', '_ColorChooserDialog') GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Picker GUICtrlSetBkColor($Label, _GUIColorPicker_GetColor($Picker)) EndSwitch WEnd |
[#/autoit3/libraries/colorchooser” ]