Jump to content

Control GUI for different Desktop Resolutions


Zari
 Share

Recommended Posts

Hi,

I been searching the topics but haven't come across what I'm looking for. I have a GUI and I want to control how it looks on various desktop resolutions. On most it is fine, but some people have text at 150% and such things. Is there anything I can do?

Link to comment
Share on other sites

Not sure exactly what you are after but you can do something like this:

GUICreate("title", @DesktopWidth-100, @DesktopHeight-100) ;control the GUI Width/Height based on screen resolution
GUISetFont(8, "", "", "Verdana") ;set a static font for the overall GUI

GUICtrlCreateLabel("hello", 10, 10, 100, 20)
GUICtrlSetFont(-1, 8, "", "", "Verdana") ;set a static for a specific controlID
Link to comment
Share on other sites

Hi,

I been searching the topics but haven't come across what I'm looking for. I have a GUI and I want to control how it looks on various desktop resolutions. On most it is fine, but some people have text at 150% and such things. Is there anything I can do?

Take a look at this:

http://www.autoitscript.com/forum/index.php?showtopic=97092

Maybe that would help.

Link to comment
Share on other sites

Are talking about the size of the controls and the gui? If so, then your best bet would be to make the coordinates of the gui as a percentage of the desktop width and height and the coordinates of the controls as a percentage of the gui. For example:

Global Const $DW = @DesktopWidth
Global Const $DH = @DesktopHeight

$GUI = GUICreate("GUI", $DW * 0.5, $DH * 0.65)
$ClientSize = WinGetClientSize($GUI)
GUICtrlCreateButton("Button", ($ClientSize[0] - ($ClientSize[0] * 0.5)) / 2, ($ClientSize[1] - ($ClientSize[1] * 0.5)) / 2, $ClientSize[0] * 0.5, $ClientSize[1] * 0.5)
;GUICtrlCreateButton("Button", (GUIWidth - ButtonWidth) * 0.5, (GUIHeight - ButtonHeight) * 0.5, ButtonWidth, ButtonHeight)
;this button will be half the width and height of the gui and will be centered on the gui in any screen resolution
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

This sounds like the label width is not long enough and is cutting off the text, I recommend setting a temporary background color to the label to assist in seeing the width and height etc. it will make it alot easier to position as well.

GUICtrlCreateLabel("here is some text", 10, 10, 100, 20)
GUICtrlSetBkColor(-1, 0x00ff00) ;green background
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...