computergroove Posted January 14, 2011 Share Posted January 14, 2011 Here is my program. I want to make the macBackground shrink/stretch to fit the MAC Hovering button. Whenever I do this, the button fails to bring up the MAC.exe program however when the pic is not stretched the program works fine. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Local $Button1, $b1label, $height, $width, $hPosition, $vPosition $height = 75 $width = 80 $hPosition = IniRead("Mac.ini", "Desktop Position", "hPosition", "Mac.ini Not Found 100") $vPosition = IniRead("Mac.ini", "Desktop Position", "vPosition", "Mac.ini Not Found 100") GUICreate("MAC Hovering Button", $width, $height, $hPosition, $vPosition, $WS_POPUP, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button1 = GUICtrlCreatePic("MacBackground.jpg", -1, -1) GUICtrlSetState(-1, $GUI_DISABLE) Opt("GUICoordMode", 2) $b1label = GUICtrlCreateLabel("", 1, 1, $width, $height, 0x201) GUICtrlSetBkColor($b1label, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetOnEvent($B1label, "Change") GUISetState() While 1 Sleep(11) WEnd Func Change() If WinExists("MAC") Then; check to see if the MAC program is already running WinActivate("MAC"); makes MAC program active Else Run('MAC.exe') ; Starts MAC program EndIf EndFunc Func _Exit() Exit EndFunc ;==>_Exit My Mac.ini looks like: [Desktop Position] hPosition=200 vPosition=200 and here is the MacBackground.jpg -> I have tried changing: $Button1 = GUICtrlCreatePic("MacBackground.jpg", -1, -1) to $Button1 = GUICtrlCreatePic("MacBackground.jpg", -1, -1, $width, $height) Is there a way to do this? When I re-size the picture to equal the pixel measurements, the picture stretches and I can only see a small part of it. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
UEZ Posted January 14, 2011 Share Posted January 14, 2011 Try this: $Button1 = GUICtrlCreatePic("un37K.jpg", 0, 0, $width, $height)Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
computergroove Posted January 14, 2011 Author Share Posted January 14, 2011 Try this: $Button1 = GUICtrlCreatePic("un37K.jpg", 0, 0, $width, $height)Br,UEZNope that did not work. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
UEZ Posted January 14, 2011 Share Posted January 14, 2011 Check out the filename of course! I used the filename as it is in attached pic! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
computergroove Posted January 14, 2011 Author Share Posted January 14, 2011 Check out the filename of course! I used the filename as it is in attached pic!Br,UEZI have the original jpg in my local au3 executing directory. Are you telling me to download the file I just uploaded and rename the file name? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
UEZ Posted January 14, 2011 Share Posted January 14, 2011 (edited) No,try this instead: $Button1 = GUICtrlCreatePic("MacBackground.jpg", 0, 0, $width, $height)I used un37K.jpg instead of MacBackground.jpg as it was uploaded with that name. The filename shouldn't be the problem!Br,UEZ Edited January 14, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
computergroove Posted January 14, 2011 Author Share Posted January 14, 2011 No,try this instead: $Button1 = GUICtrlCreatePic("MacBackground.jpg", 0, 0, $width, $height)I used un37K.jpg instead of MacBackground.jpg.Br,UEZyou can actually get rid of $Button1 since it's no longer being used. The problem isn't that your suggestion has caused a picture not to show up, it shows up fine; it's just that when I have anything after the 0,0, then when the button is clicked nothing happens. When I remove the new data from the line then the program works fine again. Stretching the picture breaks the functionality. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
UEZ Posted January 14, 2011 Share Posted January 14, 2011 (edited) Sorry, but that code is working for me. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Local $Button1, $b1label, $height, $width, $hPosition, $vPosition $height = 75 $width = 80 $hPosition = 200 ;IniRead("Mac.ini", "Desktop Position", "hPosition", "Mac.ini Not Found 100") $vPosition = 200 ;IniRead("Mac.ini", "Desktop Position", "vPosition", "Mac.ini Not Found 100") GUICreate("MAC Hovering Button", $width, $height, $hPosition, $vPosition, $WS_POPUP, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button1 = GUICtrlCreatePic("un37K.jpg", 0, 0, $width, $height) GUICtrlSetState(-1, $GUI_DISABLE) Opt("GUICoordMode", 2) $b1label = GUICtrlCreateLabel("", -1, -1) GUICtrlSetBkColor($b1label, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetOnEvent($B1label, "Change") GUISetState() While 1 Sleep(11) WEnd Func Change() ConsoleWrite("huhu") If WinExists("MAC") Then; check to see if the MAC program is already running WinActivate("MAC"); makes MAC program active Else Run('MAC.exe') ; Starts MAC program EndIf EndFunc Func _Exit() Exit EndFunc ;==>_Exit It displays the picture properly and when I click on the picture it executes the function change! Br, UEZ Edited January 14, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
computergroove Posted January 14, 2011 Author Share Posted January 14, 2011 I just tried the following and it is working like a charm now. Thanks for the help. $vPosition = IniRead("Mac.ini", "Desktop Position", "vPosition", "Mac.ini Not Found 100") GUICreate("MAC Hovering Button", $width, $height, $hPosition, $vPosition, $WS_POPUP, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlSetState(-1, $GUI_DISABLE) Opt("GUICoordMode", 2) $b1label = GUICtrlCreatePic("MacBackground.jpg", 0, 0, $width, $height);GUICtrlCreateLabel("", 1, 1, $width, $height, 0x201) GUICtrlSetBkColor($b1label, $GUI_BKCOLOR_TRANSPARENT);when disabled the box shows up grey (no pic) GUICtrlSetOnEvent($B1label, "Change");when the button is clicked then "change" function is started GUISetState() Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
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