#include #include #include #include HotKeySet("{Esc}", "_Exit") global $gui = GUICreate("ColorPicker",320,180); global $helplbl = GUICtrlCreateLabel("ESC beendet das Program",10,10,400) global $color_label = GUICtrlCreateLabel("",10,30,100,130) ; ColorValue GUICtrlCreateLabel("ColorValue",130,30) global $text_color_val = GUICtrlCreateInput("",200,30,100,20) ; RGB GUICtrlCreateLabel("Rot",130,50) global $text_red = GUICtrlCreateInput("",200,50,100,20) GUICtrlCreateLabel("Grün",130,70) global $text_green = GUICtrlCreateInput("",200,70,100,20) GUICtrlCreateLabel("Blau",130,90) global $text_blue = GUICtrlCreateInput("",200,90,100,20) ;HEX GUICtrlCreateLabel("Hex",130,110) global $text_hex = GUICtrlCreateInput("",200,110,100,20) global $breakloop = true $pickerbutton_gui = GUICtrlCreateButton("ColorPicker",130,140) $pickerbutton_own = GUICtrlCreateButton("Pick with Mouse",200,140) GUISetState() global $hex = "FFFFFF" global $color; while(1) ; just wait till the end of time... $msg = GUIGetMsg() if($msg == $GUI_EVENT_CLOSE) Then Exit endif if($msg == $pickerbutton_gui) Then $color = _ChooseColor(2, "0x" & $hex, 2, $gui) showcolor() endif if($msg == $pickerbutton_own) Then pickcolor() endif wend Func _Exit() if($breakloop == false) Then $breakloop = true; Else Exit endif EndFunc func showcolor() GUICtrlSetBkColor($color_label,$color) global $red = _ColorGetRed($color) global $green = _ColorGetGreen($color) global $blue = _ColorGetBlue($color) $hex = StringRight(Hex($red),2) & StringRight(hex($green),2) & StringRight(hex($blue),2) ; set values to gui guictrlsetdata($text_color_val,$color) guictrlsetdata($text_red,$red) guictrlsetdata($text_green,$green) guictrlsetdata($text_blue,$blue) guictrlsetdata($text_hex,$hex) endfunc func pickcolor() GUICtrlSetData($helplbl,"ESC zum Mouse-Auswahl beenden") $breakloop = false while(1) $msg = GUIGetMsg() if($msg == $GUI_EVENT_CLOSE) Then Exit endif if($breakloop == true) Then ExitLoop endif $pos = MouseGetPos(); $color = PixelGetColor( $pos[0] , $pos[1] ) showcolor() GUISetState() sleep(100) WEnd GUICtrlSetData($helplbl,"ESC beendet das Program") EndFunc