On Gui Resize Event

Thought I'd put this down as it took me ages to search the Internet for this solution.  In the end, I found it hidden away in the Autohotkey help file and not under the gui events...

The issue here is if you want to do something when a user resizes your program. 

If you search and search, you'll find that GuiClose responds to when you close the app, and GuiSize will run when you resize the app.

 

Syntax:

copyraw
GuiSize:
	GuiControl, MoveDraw, MainRedBackground, w%A_GuiWidth% h%A_GuiHeight%
Return
  1.  GuiSize: 
  2.      GuiControl, MoveDraw, MainRedBackground, w%A_GuiWidth% h%A_GuiHeight% 
  3.  Return 

If I just used GuiControl, Move, ... then this would be as above but if you are using images, then you will get problems with the image repeating... so use moveDraw which redraws the app. This will result in flickering but it's better than if it isn't redrawing.

Category: AutoHotkey :: Article: 224

Add comment

Your rating:

Submit

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Please publish modules in offcanvas position.