Page 1 of 1

StringGadget Centered Hal & Val [Windows]

Posted: Mon Jun 10, 2019 7:34 pm
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

Re: StringGadget Centered Hal & Val [Windows]

Posted: Wed Jun 12, 2019 9:17 am
by Kwai chang caine
Works great too :wink:
Thanks for sharing 8)