Jump to content

Centering a GUI label


Recommended Posts

I have a simple GUI label that take a variable length of strings and creates a number of UI panels to display those strings. The problem I am having is that the hardcoded spacing causes long strings to overflow and short string to fit improperly. Is there a way to center GUI labels? For learning purposes I am trying to avoid any UDFs and would like to do everything myself.

Link to comment
Share on other sites

Look at $SS_CENTER and $SS_CENTERIMAGE in the helpfile for centering however although you want to avoid udfs which doesn't really make much sense to me, I would highly recommend StringSize udf by Melba23, since it can work out the exact size of a label based upon font size, weight etc...

My 2 cents.

Link to comment
Share on other sites

you can also force the font on your gui to something specific so you can guarantee the text you hard code will fit in the fields since other users can have some pretty wild fonts.  I usually only do this on really complicated gui's.

GUISetFont(8.5, 400, 0, "Consolas", $hGUI, 5)

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...