Jump to content

Centered GUI on open


BoogY
 Share

Recommended Posts

In the help file read about the paramaters for GUICreate especially the ones for top and left.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Hi,

How about this.

#include <GUIConstantsEx.au3>

$width = 100 ; Width of the GUI
$height = 100 ; Height of the GUI


GUICreate("MY GUI", $width, $height, (@DesktopWidth / 2) - ($width / 2), (@DesktopHeight / 2) - ($height / 2))

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()

Exit

The GUI will surely centered in any screen resolution.

It calculate the centering of the GUI on screen by getting the Desktop width and height.

[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
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...