insignia96 Posted October 23, 2009 Share Posted October 23, 2009 This is a little tool i wrote as part of a larger project, but I liked how it turned out so i compiled it into a UDF. Basically all it does is it resizes your GUI with a bit more style then just having it explode open. Functions _Expand( $hWnd, $w_increase, $h_increase, $speed ) ; For this hWnd is the handle to the window to resize, w & h increases are the amounts to add to width and height, and speed should be a number between 1 and 10, 10 being the fastest and 1 being the slowest. _UnExpand( $hWnd, $w_decrease, $h_decrease, $speed ) ; All parameters are the same here except w & h decreases will be taken away from the GUI, not added. It can be downloaded in ZIP format here: http://iwowprogramming.com/files/public/Resizing%20UDF.zip The zip includes an example script. Also here is the UDF Source Code. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: insignia96 Script Function: Used for resizing of windows. #ce ---------------------------------------------------------------------------- Func _Expand( $hWnd, $w_increase, $h_increase, $speed ) Local $increase[4] $current = WinGetPos( $hWnd ) $increase[0] = $w_increase $increase[1] = $w_increase $increase[2] = $increase[0] + $current[2] $increase[3] = $increase[1] + $current[3] $speed = $speed / 10 For $i = $current[2] To $increase[2] Step $speed WinMove( $hWnd, "", $current[0], $current[1], $i, $current[3] ) Next $current = WinGetPos( $hWnd ) For $i = $current[3] To $increase[3] Step $speed WinMove( $hWnd, "", $current[0], $current[1], $current[2], $i ) Next EndFunc Func _UnExpand( $hWnd, $w_decrease, $h_decrease, $speed ) Local $decrease[4] $current = WinGetPos( $hWnd ) $decrease[0] = $w_decrease $decrease[1] = $h_decrease $decrease[2] = $current[2] - $decrease[0] $decrease[3] = $current[3] - $decrease[1] $speed = $speed / 10 $speed = $speed * -1 For $i = $current[2] To $decrease[2] Step $speed WinMove( $hWnd, "", $current[0], $current[1], $i, $current[3] ) Next $current = WinGetPos( $hWnd ) For $i = $current[3] To $decrease[3] Step $speed WinMove( $hWnd, "", $current[0], $current[1], $current[2], $i ) Next EndFunc The thing i used this for was making a GUI that expands downward, revealing advanced options, then is able to contract up. Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
insignia96 Posted October 24, 2009 Author Share Posted October 24, 2009 58 views and no comments? Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
novi Posted October 24, 2009 Share Posted October 24, 2009 Very useful! Thanks [COLOR=green] Link to comment Share on other sites More sharing options...
FranckGr Posted October 25, 2009 Share Posted October 25, 2009 (edited) >> The thing i used this for was making a GUI that expands downward, revealing advanced options, then is able to contract up.Exactly, by adding Opt("GUIResizeMode",802)usefull script. Thanks to share Edited October 25, 2009 by FranckGr Link to comment Share on other sites More sharing options...
insignia96 Posted October 25, 2009 Author Share Posted October 25, 2009 >> The thing i used this for was making a GUI that expands downward, revealing advanced options, then is able to contract up.Exactly, by adding Opt("GUIResizeMode",802)usefull script. Thanks to shareOMFG LOL!!!!I put a GUICtrlSetResizing( -1, 802 ) After every single control lol. I didnt know you could do that ;D Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
FranckGr Posted October 27, 2009 Share Posted October 27, 2009 (edited) OMFG LOL!!!! I put a GUICtrlSetResizing( -1, 802 ) After every single control lol. I didnt know you could do that ;D $increase[1] = $w_increase should be $increase[1] = $h_increase in _expand function Edited October 27, 2009 by FranckGr Link to comment Share on other sites More sharing options...
insignia96 Posted October 27, 2009 Author Share Posted October 27, 2009 (edited) really lol? 1 second... Fixed the DL Link. It is good now, sry bout that. Typo. Edited October 27, 2009 by insignia96 Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
Alek Posted October 28, 2009 Share Posted October 28, 2009 Might want to try with timer, it would make the resizing much more constant. Example a similar function I made a while back. Func WindowGlide($hwnd, $text, $x, $y, $width, $height, $time = 200) Local $OrgPos = WinGetPos($hwnd, $text) If @error Then Return SetError(1, 0, 0) EndIf Local $NewPos[4] Local $timer = TimerInit() Local $percent_done = 0 While TimerDiff($timer) < $time Sleep(10) $percent_done = TimerDiff($timer) / $time $NewPos[0] = $OrgPos[0] + ($x - $OrgPos[0]) * $percent_done $NewPos[1] = $OrgPos[1] + ($y - $OrgPos[1]) * $percent_done $NewPos[2] = $OrgPos[2] + ($width - $OrgPos[2]) * $percent_done $NewPos[3] = $OrgPos[3] + ($height - $OrgPos[3]) * $percent_done WinMove($hwnd, $text, $NewPos[0], $NewPos[1], $NewPos[2], $NewPos[3]) WEnd WinMove($hwnd, $text, $x, $y, $width, $height) Return 1 EndFunc [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Dolemite50 Posted October 30, 2009 Share Posted October 30, 2009 Is it just me or do the controls flicker quite a bit? Link to comment Share on other sites More sharing options...
insignia96 Posted August 24, 2010 Author Share Posted August 24, 2010 Might want to try with timer, it would make the resizing much more constant. Example a similar function I made a while back. Func WindowGlide($hwnd, $text, $x, $y, $width, $height, $time = 200) Local $OrgPos = WinGetPos($hwnd, $text) If @error Then Return SetError(1, 0, 0) EndIf Local $NewPos[4] Local $timer = TimerInit() Local $percent_done = 0 While TimerDiff($timer) < $time Sleep(10) $percent_done = TimerDiff($timer) / $time $NewPos[0] = $OrgPos[0] + ($x - $OrgPos[0]) * $percent_done $NewPos[1] = $OrgPos[1] + ($y - $OrgPos[1]) * $percent_done $NewPos[2] = $OrgPos[2] + ($width - $OrgPos[2]) * $percent_done $NewPos[3] = $OrgPos[3] + ($height - $OrgPos[3]) * $percent_done WinMove($hwnd, $text, $NewPos[0], $NewPos[1], $NewPos[2], $NewPos[3]) WEnd WinMove($hwnd, $text, $x, $y, $width, $height) Return 1 EndFunc Nice! This looks smoother than mine. Is it just me or do the controls flicker quite a bit? This is a problem I never solved. After a while it seemed stupid to spend any more time on. Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower 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