Re: GUICtrlSetBkColor ?
"valery_vi" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
Ok,
take it:
#include <GUIConstants.au3>
AutoItSetOption("WinTitleMatchMode", 4)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 633, 447, 193, 115)
$Button1 = GUICtrlCreateButton("Red", 48, 168, 65, 33, 0)
$Button2 = GUICtrlCreateButton("Green", 184, 168, 73, 33, 0)
$Group1 = GUICtrlCreateGroup("", 296, 256, 41, 41)
$Graphic1 = GUICtrlCreateGraphic(312, 272, 17, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetGraphic($Graphic1, $GUI_GR_COLOR, 0x0000FF, 0xFF0000)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 0, 0, 17, 17)
ControlHide ($Form1, "", "Static1")
ControlShow ($Form1, "", "Static1")
Case $Button2
GUICtrlSetGraphic($Graphic1, $GUI_GR_COLOR, 0x0000FF,0x00FF00)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 0, 0, 17, 17)
ControlHide ($Form1, "", "Static1")
ControlShow ($Form1, "", "Static1")
Case $Graphic1
EndSwitch
WEnd
--- In [email protected], beau <n9mfk@...> wrote:
>
> thanks Valery work good I have one question how
> can i put a edge on the box around were th color goes to make it
look
> like it is set back in the box
>
> valery_vi wrote:
> >
> > If so then try this one:
> >
> > #include <GUIConstants.au3>
> > AutoItSetOption("WinTitleMatchMode", 4)
> >
> > #Region ### START Koda GUI section ### Form=
> > $Form1 = GUICreate("AForm1", 633, 447, 193, 115)
> > $Button1 = GUICtrlCreateButton("Red", 48, 168, 65, 33, 0)
> > $Button2 = GUICtrlCreateButton("Green", 184, 168, 73, 33, 0)
> > $Group1 = GUICtrlCreateGroup("", 296, 256, 41, 41)
> > $Graphic1 = GUICtrlCreateGraphic(312, 272, 17, 17)
> > GUICtrlSetBkColor(-1, 0xFFFFFF)
> > GUICtrlCreateGroup("", -99, -99, 1, 1)
> > GUISetState(@SW_SHOW)
> > #EndRegion ### END Koda GUI section ###
> >
> > While 1
> > $nMsg = GUIGetMsg()
> > Switch $nMsg
> > Case $GUI_EVENT_CLOSE
> > Exit
> >
> > Case $Button1
> > GUICtrlSetBkColor($Graphic1, 0xFF0000)
> > ControlHide ($Form1, "", "Static1")
> > ControlShow ($Form1, "", "Static1")
> >
> > Case $Button2
> > GUICtrlSetBkColor($Graphic1, 0x008000)
> > ControlHide ($Form1, "", "Static1")
> > ControlShow ($Form1, "", "Static1")
> >
> > Case $Graphic1
> > EndSwitch
> > WEnd
> >
> > Valery
> >
> > --- In [email protected]
> > <mailto:AutoItList%40yahoogroups.com>, beau <n9mfk@> wrote:
> > >
> > > Hi Valery
> > > I have to click the button 2 times to get it to change an i
went
> > it on
> > > the first time
> > > any ideas ?
> > > valery_vi wrote:
> > > >
> > > > This works fine for me (WinXP)
> > > >
> > > > #include <GUIConstants.au3>
> > > >
> > > > #Region ### START Koda GUI section ### Form=
> > > > $Form1 = GUICreate("AForm1", 633, 447, 193, 115)
> > > > $Button1 = GUICtrlCreateButton("Red", 48, 168, 65, 33, 0)
> > > > $Button2 = GUICtrlCreateButton("Green", 184, 168, 73, 33, 0)
> > > > $Group1 = GUICtrlCreateGroup("", 296, 256, 41, 41)
> > > > $Graphic1 = GUICtrlCreateGraphic(312, 272, 17, 17)
> > > > GUICtrlSetBkColor(-1, 0xFFFFFF)
> > > > GUICtrlCreateGroup("", -99, -99, 1, 1)
> > > > GUISetState(@SW_SHOW)
> > > > #EndRegion ### END Koda GUI section ###
> > > >
> > > > While 1
> > > > $nMsg = GUIGetMsg()
> > > > Switch $nMsg
> > > > Case $GUI_EVENT_CLOSE
> > > > Exit
> > > >
> > > > Case $Button1
> > > > GUICtrlSetBkColor($Graphic1, 0xFF0000)
> > > >
> > > > Case $Button2
> > > > GUICtrlSetBkColor($Graphic1, 0x008000)
> > > >
> > > > Case $Graphic1
> > > > EndSwitch
> > > > WEnd
> > > >
> > > > Valery
> > > >
> > > > --- In [email protected]
> > <mailto:AutoItList%40yahoogroups.com>
> > > > <mailto:AutoItList%40yahoogroups.com>, beau <n9mfk@> wrote:
> > > > >
> > > > > Hi group
> > > > >
> > > > > this is a test script i am trying to change the
> > GUICtrlSetBkColor
> > > > of
> > > > > $Graphic1 when a button is pushed i went green an red
> > > > > thanks for an help
> > > > >
> > > > >
> > > > > #include <GUIConstants.au3>
> > > > >
> > > > > #Region ### START Koda GUI section ### Form=
> > > > > $Form1 = GUICreate("AForm1", 633, 447, 193, 115)
> > > > > $Button1 = GUICtrlCreateButton("AButton1", 48, 168, 65,
33, 0)
> > > > > $Button2 = GUICtrlCreateButton("AButton2", 184, 168, 73,
33, 0)
> > > > > $Group1 = GUICtrlCreateGroup("", 296, 256, 41, 41)
> > > > > $Graphic1 = GUICtrlCreateGraphic(312, 272, 17, 17)
> > > > > GUICtrlSetBkColor(-1, 0xFF0000)
> > > > > GUICtrlCreateGroup("", -99, -99, 1, 1)
> > > > > GUISetState(@SW_SHOW)
> > > > > #EndRegion ### END Koda GUI section ###
> > > > >
> > > > > While 1
> > > > > $nMsg = GUIGetMsg()
> > > > > Switch $nMsg
> > > > > Case $GUI_EVENT_CLOSE
> > > > > Exit
> > > > >
> > > > > Case $Button1
> > > > > $Graphic1 = GUICtrlCreateGraphic(312, 272, 17, 17)
> > > > > GUICtrlSetBkColor(-1, 0xFF0000)
> > > > >
> > > > > Case $Button2
> > > > > $Graphic1 = GUICtrlCreateGraphic(312, 272, 17, 17)
> > > > > GUICtrlSetBkColor(-1, 0x008000)
> > > > > Case $Graphic1
> > > > > EndSwitch
> > > > > WEnd
> > > > >
> > > >
> > > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>