Re: GUICtrlSetBkColor ?

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
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], 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>, 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]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.