yucatan Posted July 26, 2010 Share Posted July 26, 2010 i have a gui with a picture in it. is it possible that i can drag the size of my gui that i can make it wider or taler? and if i do that the picture streth so the picture if getting bigger and smaller to. but teh ratio need to be correct. so if i make it very wide but not so tall a emty gui part is coming to exsist and the ratio of the picture is still correct? this is my code now #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=imageres.dll_I0058_0409.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> OnAutoItExitRegister("whenexit") if WinExists("Aanwezigheidsbord") Then MsgBox(16, "Error", "Het Aanwezigheidsbord is al geopend.") exit endif $x = RegRead("HKEY_CURRENT_USER\Software\VBV", "X position") $y = RegRead("HKEY_CURRENT_USER\Software\VBV", "Y position") if @error Then GUICreate("Aanwezigheidsbord",647,580) Else GUICreate("Aanwezigheidsbord",647,580,$x,$y) EndIf GUISetState(@SW_SHOW) do $n = GUICtrlCreatePic("something.jpg",0, 0, 647, 584) until $n <>0 While 1 $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE Then Exit if @sec = 10 then GUICtrlSetImage($n, "something.jpg") if @sec = 25 then GUICtrlSetImage($n, "something.jpg") if @sec = 40 then GUICtrlSetImage($n, "something.jpg") if @sec = 55 then GUICtrlSetImage($n, "something.jpg") WEnd Func whenexit() $size = WinGetPos("[active]") RegWrite("HKEY_CURRENT_USER\Software\VBV", "X position", "REG_SZ", $size[0]) RegWrite("HKEY_CURRENT_USER\Software\VBV", "Y position", "REG_SZ", $size[1]) GUIDelete() EndFunc Link to comment Share on other sites More sharing options...
taietel Posted July 26, 2010 Share Posted July 26, 2010 Try this for resizing with the GUI: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $hGUI = GUICreate("GUI", 600, 400, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP), $WS_EX_LAYERED) Local $hImage = GUICtrlCreatePic(@ScriptDir & "\image.jpg", 0, 0, 600, 400) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
yucatan Posted July 26, 2010 Author Share Posted July 26, 2010 Try this for resizing with the GUI: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $hGUI = GUICreate("GUI", 600, 400, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP), $WS_EX_LAYERED) Local $hImage = GUICtrlCreatePic(@ScriptDir & "\image.jpg", 0, 0, 600, 400) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd i have tested but it wont work. i can screw the ratio if i want. the ratio is just not right. Link to comment Share on other sites More sharing options...
taietel Posted July 26, 2010 Share Posted July 26, 2010 The script was for:i have a gui with a picture in it.is it possible that i can drag the size of my gui that i can make it wider or taler?and if i do that the picture streth so the picture if getting bigger and smaller to.To keep the ratio of the picture, play with $DOCK* styles. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
yucatan Posted July 26, 2010 Author Share Posted July 26, 2010 (edited) The script was for:To keep the ratio of the picture, play with $DOCK* styles.i know i'm already trying that but it wont work when i open the gui it opens at 647,580then the view is perfect but when i make it bigger or slimmerthis is what i dont want(see the image)http://yfrog.com/n6autoitji want that it keeps it ratio.and calculate what the new size should be when i make the gui bigger. Edited July 26, 2010 by yucatan Link to comment Share on other sites More sharing options...
taietel Posted July 26, 2010 Share Posted July 26, 2010 You have to make a function for keeping the ratio of the picture. Center image in the gui, get the initial gui/picture width/height, calculate the ratio and when gui's dimensions change... and so on. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
yucatan Posted July 26, 2010 Author Share Posted July 26, 2010 You have to make a function for keeping the ratio of the picture.Center image in the gui, get the initial gui/picture width/height, calculate the ratio and when gui's dimensions change... and so on.i understand what i want has to be manualy made.i understand what to do now.the only thing that i cant figure out is wich and how the calculation must be.the weith and heith u know. may i can help me a little bit. 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