Sign in to follow this  
Followers 0

[SOLVED] GUI Resize method?


10 posts in this topic

Posted (edited)

Hi guys,

With GUICreate, when set H and W, it start from bottom-right for resize the GUI.

If i want to resize the four side starting from the center? So the four side it will be resize in the same way.

Hope i was clear, if i wasn't i'll do some screen :oops:

Thanks for support

Edited by johnmcloud

Share this post


Link to post
Share on other sites



Posted

Unless I misunderstood, try this:

GUICtrlSetResizing($Control,136)

Share this post


Link to post
Share on other sites

Posted (edited)

See equal to the normal version.

I'll do an example:

This is a gui with 243, 170, -1, -1:

Posted Image

Now is 150, 120, -1, -1:

Posted Image

As you can see, it resize from botton-right. I want a risize equal to every side, like a "Scale", not like the image.

I want a resize like this:

Posted Image

Not this:

Posted Image

I don't know how to explain better :oops:

Thanks

Edited by johnmcloud

Share this post


Link to post
Share on other sites

Posted

Try this to see if it's doing what you're asking:

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

#region - GUI Create
$GUI = GUICreate('Test', 243, 170, -1, -1, BitOR($WS_THICKFRAME, $GUI_SS_DEFAULT_GUI))
GUICtrlCreateGroup("GROUP 1", 10, 10, 223, 150)
GUICtrlSetResizing(-1, 1)
GUICtrlCreateButton("TEST", 30, 30)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE)

GUISetState()
#endregion - GUI Create

#region - GUI SelectLoop
While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
#endregion - GUI SelectLoop
Func _Exit()
    Exit
EndFunc

This demonstrates what rcmaehl was saying earlier.

Share this post


Link to post
Share on other sites

Posted

mmm not :oops:

Posted Image

A side-question: My GUI is always "on top", also if another windows is on it. How to make the gui in a second place?

Share this post


Link to post
Share on other sites

Posted

That script will in no way, shape, or form ever give you what you're showing in your picture on a properly operating computer. If that's what you're getting then either you changed the script or your computer is working weirdly. I ran that script on Windows XP x86, and Windows 7 x64 and x86, I also tried it on AutoIt versions 3.3.6.1, 3.3.8.1, beta 3.3.9.1 and none of them showed that behavior.

Share this post


Link to post
Share on other sites

Posted (edited)

Try this:

;coded by UEZ
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $hGUI = GUICreate("Proportional Scale", 243, 170, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME))
Global Const $idGroup = GUICtrlCreateGroup("Group1", 16, 8, 215, 150)
Global Const $idButton = GUICtrlCreateButton("Test", 50, 50, 50, 30)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

Global $aWS = WinGetPos($hGUI)
Global Const $ratio = $aWS[3] / $aWS[2]
Global Const $minSize = Int($aWS[2] * 0.75)
Global Const $maxSize = Int($aWS[2] * 2)

GUIRegisterMsg($WM_SIZING, "WM_SIZING")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

Global $nMsg

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_SIZING, "")
            GUIRegisterMsg($WM_GETMINMAXINFO, "")
            GUIDelete($hGUI)
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, $minSize) ; min X
    DllStructSetData($minmaxinfo, 8, $minSize) ; min Y
    DllStructSetData($minmaxinfo, 9, $maxSize) ; max X
    DllStructSetData($minmaxinfo, 10, $maxSize) ; max Y
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_GETMINMAXINFO

Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    Local $sRect = DllStructCreate("Int[4]", $lParam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)

    Switch $wParam ;drag side or corner
        Case 1, 2, 4, 7
            $iNewY = Int(($right - $left) * $ratio)
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNewY, 4)
        Case Else
            $iNewX = Int(($bottom - $top) / $ratio)
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNewX, 3)
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_SIZING

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites

Posted (edited)

I'm testing both and work. The BrewManNH's script not work before because i have manually edit the value of the GUI ( was my first intention, scale in base at the value of the GUI). I think its a better result your script. Thanks also to UEZ, it's a perfect scale :oops:

My last problem, why this GUI is "always at top"?:

$GUIHeight = 25
$GUIWidth = 50

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)
;~ GUISetBkColor(0xABCDEF)
$Area_GUI_1 = GUICtrlCreateLabel("", 0, 0, $GUIWidth, $GUIHeight)
_WinAPI_SetLayeredWindowAttributes($GUI_1, 0xABCDEF, 255)
GUISetState()

How to remove?

Edited by johnmcloud

Share this post


Link to post
Share on other sites

Posted

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)

is wrong because of the last parameter you set! $WS_EX_TOOLWINDOW is set as parent parameter!

Try instead:

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOOLWINDOW)

Br,

UEZ

Share this post


Link to post
Share on other sites

Posted (edited)

UEZ, same problem. I'll post all the script:

EDIT: Maybe better open a new thread for this. Thanks to all :oops:

Edited by johnmcloud

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  
Followers 0