Jump to content

Gui resize dynamically - (Moved)


Iose
 Share

Recommended Posts

With GUICreate ("Frame", 1270, 600), I set a fixed size of a frame. 
With GUICreate ("Frame", @DesktopWidth, @DesktopHeight), I set it, according to the size of my desktop.

But if you wanted to adapt it dynamically to the size of the window that opens, do you know how to do?

Thank u!

 

 

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I also needed something like this HERE and I ended up creating my own code, I hope it works for you too.

; =========================================
; Autoit3 3.3.9.4
; Date: 10/12/17
; Autor: Belini
; Function: Resize Gui to other resolutions
; =========================================

; Use "W" for horizontal coordinate or length
; Use "H" for vertical coordinate or height
; Use "F" for font size

$Res_W_Original = 1440; Informs here the horizontal resolution in which the gui was made
$Res_H_Original = 900; Informs here the vertical resolution in which the gui was made
$Res_W_Current = @DesktopWidth; Desktop Horizontal Resolution
$Res_H_Current = @DesktopHeight; Desktop Vertical Resolution


#region ### START Koda GUI section ### Form
$Form1 = GUICreate("Example Auto Size", Auto_size(446, "W"), Auto_size(476, "H"), -1, -1)

$Edit1 = GUICtrlCreateEdit("", Auto_size(8, "W"), Auto_size(8, "H"), Auto_size(433, "W"), Auto_size(385, "H"))
GUICtrlSetBkColor(-1, 0x000000)

$Group1 = GUICtrlCreateGroup("Command", Auto_size(8, "W"), Auto_size(400, "H"), Auto_size(433, "W"), Auto_size(67, "H"))
GUICtrlSetFont(-1, Auto_size(10, "F"), 400, 0, "MS Sans Serif")

$Input1 = GUICtrlCreateInput("", Auto_size(16, "W"), Auto_size(423, "H"), Auto_size(337, "W"), Auto_size(29, "H"))

$Button1 = GUICtrlCreateButton("Send", Auto_size(356, "W"), Auto_size(424, "H"), Auto_size(75, "W"), Auto_size(30, "H"))
GUICtrlSetFont(-1, Auto_size(12, "F"), 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func Auto_size($value = 0, $opt = "W")
    Local $result
    Switch $opt
        Case "W"
            If $value = -1 Then
                $result = -1
            Else
                $result = $Res_W_Original / $value
                $result = $Res_W_Current / $result
            EndIf
        Case "H"
            If $value = -1 Then
                $result = -1
            Else
                $result = $Res_H_Original / $value
                $result = $Res_H_Current / $result
            EndIf
        Case "F"
            If $value = -1 Then
                $result = -1
            Else
                $result = $Res_H_Current / $Res_H_Original
                $result = $value * $result
            EndIf
    EndSwitch
    Return $result
EndFunc   ;==>Auto_size

 

Edited by Belini
Link to comment
Share on other sites

WinGetClientSize ( "title" [, "text"] )

will return the size of a  window.   

winmove()allows for resize options. 

(Idk why my text has a yellow background...)

edit.  

GUICtrlSetResizing ( controlID, resizing )

has control repositioning and resizing options.

Edited by JLogan3o13
Link to comment
Share on other sites

  • Moderators
On 9/6/2018 at 1:54 PM, markyrocks said:

(Idk why my text has a yellow background...)

Not sure why it had to be a 72pt. font either...

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...