StringGadget Centered Hal & Val [Windows]

Share your advanced PureBasic knowledge/code with the community.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

StringGadget Centered Hal & Val [Windows]

Post by RASHAD »

Hi
Very simple and very flexible

Have fun

Code: Select all

LoadFont(0,"Tahoma",24)

OpenWindow(0, 0, 0, 600, 400, "StringGadget ", #PB_Window_SystemMenu|#PB_Window_ScreenCentered| #PB_Window_SizeGadget)
SetWindowColor(0,#White)
ContainerGadget(0,10,10,580,110,#PB_Container_Flat)
  SetGadgetColor(0,#PB_Gadget_BackColor,$FFFFFF)
  StringGadget(1, 0,0,580,120,"ABCDE-JQMN"+#CRLF$+"Hello",#PB_String_BorderLess| #ES_CENTER | #ES_MULTILINE)
  SetGadgetColor(1,#PB_Gadget_FrontColor,$0000FF)
CloseGadgetList()
ch = GadgetHeight(0)
;SetWindowLongPtr_(GadgetID(1),#GWL_EXSTYLE, GetWindowLongPtr_(GadgetID(1),#GWL_EXSTYLE)&~ #WS_EX_CLIENTEDGE)
SetGadgetFont(1,FontID(0))
sh = GadgetHeight(1,#PB_Gadget_RequiredSize)*2 ;No of Lines
ResizeGadget(1,0,ch/2-sh/2,#PB_Ignore,sh)

Repeat

Until WaitWindowEvent() = #PB_Event_CloseWindow
Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: StringGadget Centered Hal & Val [Windows]

Post by Kwai chang caine »

Works great too :wink:
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
Post Reply