gcue Posted August 25, 2008 Share Posted August 25, 2008 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 More sharing options...
AdmiralAlkex Posted August 25, 2008 Share Posted August 25, 2008 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gcue Posted August 25, 2008 Author Share Posted August 25, 2008 (edited) i want to center text. i tried using ss_center but that centers in the cell not the msgbox Edited August 25, 2008 by gcue Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 25, 2008 Share Posted August 25, 2008 i want to center text.i tried using ss_center but that centers in the cell not the msgboxIf 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 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gcue Posted August 25, 2008 Author Share Posted August 25, 2008 what do you mean by BITOR ? can you show me an example? thanks Link to comment Share on other sites More sharing options...
Andreik Posted August 25, 2008 Share Posted August 25, 2008 (edited) 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 August 25, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 25, 2008 Share Posted August 25, 2008 what do you mean by BITOR ? can you show me an example? thanksI 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 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gcue Posted August 25, 2008 Author Share Posted August 25, 2008 got it!! thank you for your quick response. 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