gr1fter Posted August 27, 2015 Share Posted August 27, 2015 Hello, I have this test script and its driving me crazy. I want to display a full screen GUI, but I can't get the labels to stay in position on different monitors.Here is my test code:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $gui = GUICreate("Test GUI", @DesktopWidth, @DesktopHeight, 0, 0, BitOr($WS_CAPTION, $WS_SYSMENU, $WS_POPUP, $WS_MAXIMIZE)) GUISetState (@SW_LOCK) GUISetBkColor(0xFFFFFF) ;Labels $mainlabel_line1 = GUICtrlCreateLabel("This is a test,", @DesktopWidth/3-450, @DesktopHeight/2-250, 310, 35) $mainlabel_line2 = GUICtrlCreateLabel("I want this label to stay in the same position on multiple resolutions",@DesktopWidth/3-450, @DesktopHeight/2-180, 675, 100) $font = "Arial" GUICtrlSetFont ($mainlabel_line1,22,1000,"",$font) GUICtrlSetFont ($mainlabel_line2,22,1000,"",$font) GUISetState(@SW_ENABLE) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd on the machine I am creating the script, it works great and shows correctly. This is on 1920x1200 resolution. When i go to a machine that is 1280x1024 and run the script, all the labels get messed up. I posted screenshots of what it looks like. Is there anyway that I can have my labels set no matter what resolution I go to?Thanks, Link to comment Share on other sites More sharing options...
JohnOne Posted August 27, 2015 Share Posted August 27, 2015 (edited) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Left = 100 $gui = GUICreate("Test GUI", @DesktopWidth, @DesktopHeight, 0, 0, BitOr($WS_CAPTION, $WS_SYSMENU, $WS_POPUP, $WS_MAXIMIZE)) GUISetState (@SW_LOCK) GUISetBkColor(0xFFFFFF) ;Labels $mainlabel_line1 = GUICtrlCreateLabel("This is a test,", $Left, @DesktopHeight/2-250, 310, 35) $mainlabel_line2 = GUICtrlCreateLabel("I want this label to stay in the same position on multiple resolutions",$Left, @DesktopHeight/2-180, 675, 100) $font = "Arial" GUICtrlSetFont ($mainlabel_line1,22,1000,"",$font) GUICtrlSetFont ($mainlabel_line2,22,1000,"",$font) GUISetState(@SW_ENABLE) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEndEDIT:Or maybe you mean something like...$Left = Mod(@DesktopWidth / 4, @DesktopWidth) Edited August 27, 2015 by JohnOne gr1fter 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gr1fter Posted August 28, 2015 Author Share Posted August 28, 2015 setting a static Left worked! man i thought way too much into it and it was something simple. Thank you! Link to comment Share on other sites More sharing options...
JohnOne Posted August 28, 2015 Share Posted August 28, 2015 Ace. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
water Posted August 28, 2015 Share Posted August 28, 2015 Or use GUICtrlSetResizing to specify the resizing method used by a control. Example:GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)Sets the resizing method for the last control to dock at the top and right and to keep widht and height. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now