Jump to content
Sign in to follow this  

Simple form resize based on client size

Recommended Posts


After searching through the forums for methods to re-size a form/window, I was frustrated with complexity of many of the solutions, so here is what I came up with. This should re-size the form to have the provided client size, regardless what title bar or border settings are used, or what menu controls are used.

I do not believe it does, but I extend my apologies if this duplicates something someone else has already done.

Func _GUIResizeClient($hWnd, $iSizeX, $iSizeY)
    ;$hWnd = Handle for the form to be resized
    ;$iSizeX = Desired X size for the client area
    ;$iSizeY = Desired Y size for the client area
    Local $winpos = WinGetPos($hWnd)
    Local $wincli = WinGetClientSize($hWnd)
    WinMove($hWnd, "", $winpos[0], $winpos[1], $iSizeX + ($winpos[2]-$wincli[0]), $iSizeY + ($winpos[3]-$wincli[1]))

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.