 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Bwootan Guest
|
Posted: Sun Jan 25, 2009 1:45 pm Post subject: picture button flickers |
|
|
i made this custom button:
| Code: | gui,add, picture,x490 y490 BackgroundTrans gLabelToExecute vFoldButton, SmallButton_Off.png
gui,show,h547 w794 , New GUI Window 1
return
LabelToExecute:
guicontrol,,FoldButton,SmallButton_On.png
return |
there is two problems:
-if i click on the button it changes the pictures, but it always blinks in the area of the original picture.its a rounded button and i made the corners transparent.
-If i release the left mousebutton it should return to the original button (SmallButton_Off.png) i couldnt figure out how to do it. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sun Jan 25, 2009 1:56 pm Post subject: |
|
|
Con you post samples of PNGs ? _________________ URLGet - Internet Explorer based Downloader |
|
| Back to top |
|
 |
Bwootan Guest
|
Posted: Sun Jan 25, 2009 3:24 pm Post subject: |
|
|
button on
button off
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sun Jan 25, 2009 3:42 pm Post subject: |
|
|
| Code: | SetWorkingDir, %A_ScriptDir%
Gui, Add, Picture,x200 y200 BackgroundTrans AltSubmit gToExecute vFoldButton, SmallButton_Off.png
Gui, Show,, New GUI Window 1
return
ToExecute:
GuiControl,, FoldButton, SmallButton_On.png
Loop {
If ! GetKeyState( "LBUTTON", "P" )
Break
Sleep 50
}
GuiControl,, FoldButton, SmallButton_Off.png
Return |
_________________ URLGet - Internet Explorer based Downloader |
|
| Back to top |
|
 |
Pil
Joined: 26 Feb 2006 Posts: 55 Location: Recife Brazil
|
Posted: Sun Jan 25, 2009 4:10 pm Post subject: |
|
|
Just because I know you are expert in graphics. :)
The exchange of images causes flickering
Regards
Noel |
|
| Back to top |
|
 |
Bwootan Guest
|
Posted: Sun Jan 25, 2009 4:47 pm Post subject: |
|
|
SKAN: thank u for the code. works very smooth.
| Quote: | | The exchange of images causes flickering |
other programs use also picture changing without any problem.any idea how to get rid of it. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sun Jan 25, 2009 8:54 pm Post subject: |
|
|
GuiControl redraws the control and hence the window background is momentarily visible causing the flicker. I tried with GDI+ to update the image without redrawing and it works - with zero flicker - but the rounded corners of the button lose anti-alias and forms a thick shadow. Not worth the code.
Edit: Square/Rectangle works alright. |
|
| Back to top |
|
 |
Pil
Joined: 26 Feb 2006 Posts: 55 Location: Recife Brazil
|
Posted: Sun Jan 25, 2009 9:56 pm Post subject: |
|
|
What about:
| Code: | Gui, Add, Picture,x200 y200 BackgroundTrans AltSubmit gToExecute , SmallButton_Off.png
Gui, Add, Picture,x200 y200 BackgroundTrans AltSubmit gToExecute , SmallButton_On.png
Gui, Show,, New GUI Window 1
return
ToExecute:
GuiControl, Hide, static2
Loop {
If ! GetKeyState( "LBUTTON", "P" )
Break
Sleep 50
}
GuiControl, Show, static2
Return |
Regards,
Noel |
|
| Back to top |
|
 |
Bwootan Guest
|
Posted: Mon Jan 26, 2009 12:05 am Post subject: |
|
|
the gui looks like this
has the following elements
-background (red carpet)
-table (png transparent background)
-avatars (png transparent background(smaller)
-the buttons
if i do it with Noel's technique and press the button the table disappears (the two avatars stay- although they are partly ON the table)
here is the code if it helps:
| Code: |
gui,add, picture,x0 y0, table.jpg ;Background
gui,add, picture,x0 y0 BackgroundTrans, TableRT.png ; Table
gui,add, picture,x270 y206 BackgroundTrans vflop1,
gui,add, picture,x323 y206 BackgroundTrans vflop2,
gui,add, picture,x376 y206 BackgroundTrans vflop3,
gui,add, picture,x429 y206 BackgroundTrans vturn,
gui,add, picture,x481 y206 BackgroundTrans vriver,
gui,add, picture,x48 y184 BackgroundTrans vplayerCard1,
gui,add, picture,x65 y184 BackgroundTrans vplayerCard2,
gui,add, picture,x678 y184 BackgroundTrans vcpuCard1, 7d.png
gui,add, picture,x695 y184 BackgroundTrans vcpuCard2, back.png
gui,add, picture,x0 y210 BackgroundTrans vseat1, SeatRT_Off.png
gui,add, picture,x628 y210 BackgroundTrans vseat2, SeatRT_Off.png
gui,add, picture,x105 y227 BackgroundTrans vavatar1, avatar1.png
gui,add, picture,x735 y227 BackgroundTrans vavatar2, avatar2.png
gui,add, picture,x490 y490 BackgroundTrans AltSubmit gToExecute , SmallButton_On.png
gui,add, picture,x490 y490 BackgroundTrans AltSubmit gToExecute , SmallButton_Off.png
gui,add, picture,x594 y490 BackgroundTrans, SmallButton_Off.png
gui,add, picture,x699 y490 BackgroundTrans, SmallButton_Off.png
gui, font,c0xFFFFFF s6,
gui, add, text, x39 y233 BackgroundTrans,PLayer1
gui, add, text, x669 y233 BackgroundTrans,Player2
gui, font,c0xFFFFFF s6 bold ,
gui, add, text, x35 y248 BackgroundTrans,$40,000
gui, add, text, x675 y248 BackgroundTrans,$137
gui,show,h547 w794 , New GUI Window 1 ;
return
ToExecute:
GuiControl,hide,static3
Loop {
If ! GetKeyState( "LBUTTON", "P" )
Break
Sleep 50
}
GuiControl,Show,static3
Return
|
|
|
| Back to top |
|
 |
Pil
Joined: 26 Feb 2006 Posts: 55 Location: Recife Brazil
|
Posted: Mon Jan 26, 2009 9:23 pm Post subject: |
|
|
Use Window Spy, (comes with AHK) to see what contol the picture belongs to. Static 1..2 or whatever.
Probably table is using static3.
Regards
Noel |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|