maxi39
Habs noch was verfeinert. Nette Idee mit Graphic
Ich nahm bisher immer Buttons.
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Local $Graf1 = 16711680
Local $Graf2 = 65280
$Form1 = GUICreate("Graphic Farbe wechseln", 325, 145, 322, 324)
$Graphic1 = GUICtrlCreateGraphic(224, 32, 84, 36)
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0xFF0000)
$Button1 = GUICtrlCreateButton("on", 40, 32, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("off", 128, 32, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1
GUICtrlSetBkColor($Graphic1, $Graf2)
GUICtrlCreateLabel(Hex($Graf2) & " " & "ist gleich" & " " & $Graf2 & " " & "Decimal" & " " & "also Grün", 8 , 95 , 350 , 15)
GUICtrlSetFont(-1, 10, 800, 0, "Myriad Web")
case $Button2
GUICtrlSetBkColor($Graphic1, $Graf1)
GUICtrlCreateLabel(Hex($Graf1) & " " & "ist gleich" & " " & $Graf1 & " " & "Decimal" & " " & "also Rot", 8 , 120 , 350 , 15)
GUICtrlSetFont(-1, 10, 800, 0, "Myriad Web")
EndSwitch
WEnd