Sign in to follow this  
Followers 0
Zari

Control GUI for different Desktop Resolutions

6 posts in this topic

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?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Hi,

I guess I should have clarified things a little more. I am using GUICtrlCreateLabel and on some screen resolutions the words are cut off or just messed up.

Share this post


Link to post
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

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