Jump to content
ronaldo97

How do I make GUI are compatible with the computer screen size

Recommended Posts

ronaldo97
Hello :D
How can I make the GUI is  compatible with all screen sizes ?? :(

 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 445, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZE))
GUISetBkColor(0x1E1E1E)
$Label1 = GUICtrlCreateLabel("Welcome Back !!", 424, 64, 161, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Tahoma")
GUICtrlSetColor(-1, 0x800000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
How do I make Gui interface compatible with all screen sizes ??

800*600

1024*768

1280*1024

Edited by ronaldo97

Share this post


Link to post
Share on other sites
Melba23

ronaldo97,

The @DeskTopWidth & @DeskTopHeight macros will give you the screen size - you then need to calculate what size and position you require for the GUI. Create the GUI at full size and use GUICtrlSetResizing on the controls (or use Opt("GUIResizeMode")) so that the controls will resize as well. Then resize and move the GUI like this:

; Set GUI to required position and size
 GUISetState(@SW_HIDE)
 WinMove($hGUI, "", $iMain_X, $iMain_Y, $iMain_W, $iMain_H)
 GUISetState(@SW_SHOW)

Please ask if you have any questions.

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
ronaldo97
5 hours ago, Melba23 said:

ronaldo97,

The @DeskTopWidth & @DeskTopHeight macros will give you the screen size - you then need to calculate what size and position you require for the GUI. Create the GUI at full size and use GUICtrlSetResizing on the controls (or use Opt("GUIResizeMode")) so that the controls will resize as well. Then resize and move the GUI like this:

; Set GUI to required position and size
 GUISetState(@SW_HIDE)
 WinMove($hGUI, "", $iMain_X, $iMain_Y, $iMain_W, $iMain_H)
 GUISetState(@SW_SHOW)

Please ask if you have any questions.

M23

Thank hou very much !!

 

Please explain to me possible video ??:'(

Edited by ronaldo97

Share this post


Link to post
Share on other sites
Melba23

ronaldo97,

Quote

Please explain to me possible video?

Why do you need a video? Just run this:

#include <GUIConstantsEx.au3>

; Get controls to resize with the GUI
Opt("GUIResizeMode", $GUI_DOCKAUTO)

; Get screen size
$iScreenWidth = @DesktopWidth
$iScreenHeight = @DesktopHeight

; Calculate required size and position
$iGUIX = 100
$iGUIY = 100
$iGUIWidth = $iScreenWidth - ($iGUIX * 2)
$iGUIHeight = $iScreenHeight - ($iGUIY * 2)

; Create GUI for assumed "normal" case
$hGUI = GUICreate("Test", 500, 500)

$cLabel = GUICtrlCreateLabel("This is the GUI at the size you created", 10, 10, 250, 50)
GUICtrlSetBkColor($clabel, 0xFFCCCC)

$cButton = GUICtrlCreateButton("Press me to resize the GUI", 10, 400, 150, 50)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            GUICtrlSetData($cLabel, "See how everything in the GUI" & @CRLF & "is resized along with the GUI?")
            ; Resize and relocate GUI as required
            WinMove($hGUI, "", $iGUIX, $iGUIY, $iGUIWidth, $iGUIHeight)
    EndSwitch

WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

  • Similar Content

    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
    • santoshM
      By santoshM
      Dear friends i am facing a problem , i have created a window in autoit some time it is moving with the mouse curser even if iam not clicking the window 
    • sumanth1980
      By sumanth1980
      Here i am wrote a simple lines to install basic applications but when i clicked on one application/program to install it was working fine but when i cancel the program in the middle to install another program it was not working. I am not an expert in this but i want a solution for this ... Can any one help me on this....
      ORG-1.au3
×