RobbyCeyssens Posted September 3, 2008 Share Posted September 3, 2008 Hi, I created an image control and resize the image together with the window. When I update the image control with GUICtrlSetImage($Pic, "new_image.jpg") the image doesn't resize to the dimensions of the previous resized image. I found some topics concerning this problem with suggestions to use: GUISetState (@SW_HIDE) GUISetState (@SW_SHOW) after GUICtrlSetImage($Pic, "new_image.jpg") but this doesn't seem to help. If I don't resize the window everything works fine. I'm using the latest stable version of AutoIt. Thx CODE#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Opt("GUIResizeMode", $GUI_DOCKAUTO) Example() Func Example() Local $msg, $Pic Opt("GUICoordMode", 2) GUICreate("My InputBox", 800, 600, -1, -1, $WS_SIZEBOX) ; start the definition $Pic = GUICtrlCreatePic(@DesktopDir & "/test.jpg", 0, 0, 200, 200) GUISetState() ; to display the GUI ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Pic Then GUICtrlSetImage($Pic,@DesktopDir & "\test\images\01.jpg") WEnd EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Zedna Posted September 3, 2008 Share Posted September 3, 2008 Look at GUICtrlSetResizing() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
rasim Posted September 3, 2008 Share Posted September 3, 2008 (edited) RobbyCeyssensWelcome!Try this:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Opt("GUIResizeMode", $GUI_DOCKAUTO) Example() Func Example() Local $iPrevCoord, $hGUI, $msg, $Pic, $cSize Opt("GUICoordMode", 2) $hGUI = GUICreate("My InputBox", 800, 600, -1, -1, $WS_SIZEBOX) ; start the definition $Pic = GUICtrlCreatePic(@DesktopDir & "\test.jpg", 0, 0, 200, 200) GUISetState() ; to display the GUI ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Pic Then $iPrevCoord = Opt("GUICoordMode", 1) $cSize = ControlGetPos($hGUI, "", $Pic) GUICtrlSetImage($Pic, @DesktopDir & "\test\images\01.jpg") GUICtrlSetPos($Pic, $cSize[0], $cSize[1], $cSize[2], $cSize[3]) Opt("GUICoordMode", $iPrevCoord) EndIf WEnd EndFunc ;==>Example Edited September 3, 2008 by rasim Link to comment Share on other sites More sharing options...
RobbyCeyssens Posted September 9, 2008 Author Share Posted September 9, 2008 Almost forgot to thank you guys for helping me out ! 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