Jump to content
Deye

gui aspect resizing

Recommended Posts

Deye
Quote

 

The First step I have now solved : "What this needs: is to keep the center axis while holding the the mouse pressed on the gui when dragging to resize the gui "

in my next post I'm adding in controls to see how they can also resize accordingly For anyone who wants to try their own solutions

 

 

#include <GuiconstantsEx.au3>
#include <Misc.au3>

$hDLL = DllOpen("user32.dll")
OnAutoItExitRegister("On_Exit")

Global $iWidth = 360, $iHeight = 180
$hGUI = GUICreate("Explode & implode", $iWidth, $iHeight, -1, -1)
GUISetBkColor(0X89A5D3, $hGUI)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "long", 0x00040010)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_close
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            OnDrag()
    EndSwitch
WEnd

Func OnDrag()
    Local $width, $height, $aCurInfo = GUIGetCursorInfo($hGUI)
    If $aCurInfo[4] = 0 Then ; Mouse not over a control
        Local $aGPos = WinGetPos($hGUI)
        Local $aMPos = MouseGetPos()
        While _IsPressed("01", $hDLL)
            Sleep(20)
            $aPos = MouseGetPos()
            $height = ($aGPos[3] / $aGPos[2]) * ($aGPos[2] + ($aMPos[1] - $aPos[1]) - ($aMPos[0] - $aPos[0]))
            If $height > @DesktopHeight - 40 Or $height <= $iHeight Then ContinueLoop
            $width = ($aGPos[2] / $aGPos[3]) * $height
            WinMove($hGUI, "", ($aGPos[2] / 2) + $aGPos[0] - ($width / 2), ($aGPos[3] / 2) + $aGPos[1] - ($height / 2), $width, $height)
            Sleep(20)
        WEnd
    EndIf
EndFunc

Func On_Exit()
    DllClose($hDLL)
EndFunc

 

Edited by Deye
first step solved and fixed

Share this post


Link to post
Share on other sites
Deye

Removed

Edited by Deye

Share this post


Link to post
Share on other sites
Deye

the Implode & explode code is now fixed, can also be found here
for now and for the controls resizing, the autoresizing will just have to do ..

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

×

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.