b8bboi Posted May 5, 2006 Posted May 5, 2006 I modified the code from the GuiCtrlCreatePic example to get WinSetTrans to work with a transparent GIF. expandcollapse popup;----- example 2 #include "GUIConstants.au3" $gui=GUICreate("test transparentpic", 200, 100) $pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) HotKeySet("{ESC}", "main") HotKeySet("{LEFT}", "left") HotKeySet("{RIGHT}", "right") HotKeySet("{DOWN}", "down") HotKeySet("{UP}", "up") $picPos = WinGetPos($pic) $guiPos = WinGetPos($gui) WinSetTrans($pic, "", 120) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE Exit Func main() $guiPos = WinGetPos($gui) WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10) EndFunc Func left () $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]-10,$picPos[1]) EndFunc Func right() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]+10,$picPos[1]) EndFunc Func down() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]+10) EndFunc Func up() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]-10) EndFunc Notice line 19 which is what I added. WinSetTrans($pic, "", 120) This didn't work. There's a white background around the GIF. However, as soon as I comment out line 19, the background will go away and the transparent GIF works again. It's one thing or the other. Does anyone know why? Thanks.
Moderators SmOke_N Posted May 5, 2006 Moderators Posted May 5, 2006 (edited) Gremlins? Try to use GUICtrlSetState($pic, $GUI_DISABLE) WinSetTrans($pic, "", 120)I don't know if that will work though. Edit: Had the wrong function call. Edited May 5, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
b8bboi Posted May 5, 2006 Author Posted May 5, 2006 Thanks but that didn't work. Gremlins? Try to use GUICtrlSetState($pic, $GUI_DISABLE) WinSetTrans($pic, "", 120)I don't know if that will work though. Edit: Had the wrong function call.
dabus Posted May 5, 2006 Posted May 5, 2006 Try this: $Gui = GUICreate('Test', 300, 300, 300, 300, $WS_POPUP, $WS_EX_LAYERED+$WS_EX_TOPMOST ) $BG = GUICtrlCreatePic('AllTrans.gif', 0, 0, 300, 300, 0) You have to create a transparent gif named AllTrans.gif (or something). The second line will set this transparent gif as the background-picture. Don't forget the ...,0), since this puts the image behind the other gif-pictures. Otherwise, they would not be 'clickable'.
GaryFrost Posted May 5, 2006 Posted May 5, 2006 using Larry's dll located at http://www.autoitscript.com/forum/index.ph...opic=19185&st=0expandcollapse popup#include "GUIConstants.au3" $gui=GUICreate("test transparentpic", 200, 100) $pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) $a = DLLCall(".\BMP2RGN.dll","int","BMP2RGN", _ "str",@Systemdir & "\oobe\images\merlin.gif", _ "int",0, _ "int",0, _ "int",0) SetWindowRgn($pic, $a[0]) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) HotKeySet("{ESC}", "main") HotKeySet("{LEFT}", "left") HotKeySet("{RIGHT}", "right") HotKeySet("{DOWN}", "down") HotKeySet("{UP}", "up") $picPos = WinGetPos($pic) $guiPos = WinGetPos($gui) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE Exit Func main() $guiPos = WinGetPos($gui) WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10) EndFunc Func left () $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]-10,$picPos[1]) EndFunc Func right() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]+10,$picPos[1]) EndFunc Func down() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]+10) EndFunc Func up() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]-10) EndFunc Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
b8bboi Posted May 5, 2006 Author Posted May 5, 2006 gafrost, I tried that and it didn't work. I still get the white background. I guess this is just a limitation of WinSetTrans.
Moderators SmOke_N Posted May 5, 2006 Moderators Posted May 5, 2006 gafrost, I tried that and it didn't work. I still get the white background.I guess this is just a limitation of WinSetTrans.Stands to reason that WinSetTrans() is not concentrating on your pic but on the total region that your calling? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
GaryFrost Posted May 5, 2006 Posted May 5, 2006 (edited) gafrost, I tried that and it didn't work. I still get the white background.I guess this is just a limitation of WinSetTrans.The code I posted doesn't have winsettrans in it, and it works. (need beta)gets rid of the background, pic itself is not transparent tho. Edited May 5, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now