Jump to content

display: accounting for windows themes


gcue
 Share

Recommended Posts

in a msgbox, i try to center a guictrlcreatelabel by entering number coordinates and eyeballing something that looks centered.

but if the script is run under a different windows theme.. it throws it all off.. i tried looking for a way to center a guictrlcreatelabel but didnt see anything

is this possible?

Link to comment
Share on other sites

I don't understand, is it the control or the text you want centered?

If control use some math to calculate the center.

If text then use BitOR($SS_CENTER, $SS_CENTERIMAGE) as the style.

Link to comment
Share on other sites

i want to center text.

i tried using ss_center but that centers in the cell not the msgbox

If you put the control in the middle and then use BitOR($SS_CENTER, $SS_CENTERIMAGE) then the text will be in the middle! So if msgbox is 100 pixels wide then create a label that is the same width and the text will be in the middle!

$SS_CENTERIMAGE = horizontal center

$SS_CENTER = vertical center

Link to comment
Share on other sites

what do you mean by BITOR ?

can you show me an example?

thanks

BitOR in this case is to combine styles. For example:
GUICreate("EXAMPLE",400,400,-1,-1,BitOR(0x00100000,0x00200000,0x00080000))
GUISetState()

While 1
    If GUIGetMsg() = -3 Then Exit
    Sleep(15)
WEnd

First parameter of BitOR is $WS_HSCROLL, next is $WS_VSCROLL and last is $WS_SYSMENU.

Now I create a GUI with this styles. ;)

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

what do you mean by BITOR ?

can you show me an example?

thanks

I haven't sleept for very long so this maybe not makes any sence but I believe I meant something like:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

GUICreate("Sample gui", 320, 240, 0, 0)
GUICtrlCreateLabel("This text is in the middle", 0, 0, 320, 240, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUICreate("Sample gui2", 320, 240, 0, 0)
GUICtrlCreateLabel("This text is also in the middle", 80, 60, 160, 120, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

As you see the text is in the middle of the controls which are in the middle of the gui ;)

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