Jump to content

Can someone tell me how to centralize a label control in window


Recommended Posts

Do I have to use absolute coordinate?

Some thing like this:

GUICtrlCreateLabel ( "text", left, top, width , height )

Thanks in advance!

Sam

If Zedna's solution isn't right for you, then yes, you will have to do the math, but it's not hard. If your GUI's width is already in a variable you're almost done. If not, then get it with WinGetPos() ([2] = width in the returned array).

$avWinPos = WinGetPos($hGUI)
$W = 150, $H = 20, $X = ($avWinPos[2] - $W) / 2, $Y = ($avWinPos[3] - $H) /2
GuiCtrlCreateLabel("text", $X, $Y, $W, $H)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...