I wonder if somebody posted alike before this post (It should be)
Code: Select all
Global fID,hh
Procedure setColor(cont,gad,bkcolor,fcolor)
If bkcolor <= 0
SetGadgetColor(cont,#PB_Gadget_BackColor,$FFFFFF)
Else
SetGadgetColor(cont,#PB_Gadget_BackColor,bkcolor)
SetGadgetColor(gad,#PB_Gadget_BackColor,bkcolor)
EndIf
SetGadgetColor(gad,#PB_Gadget_FrontColor,fcolor)
EndProcedure
Procedure fHeight(fName$,fSize)
fID = LoadFont(#PB_Any,fName$,fSize)
hdc = StartDrawing(WindowOutput(0))
DrawingFont(FontID(fID))
hh = TextHeight("Q") + 6
StopDrawing()
EndProcedure
Procedure SizeCB()
ResizeGadget(10,#PB_Ignore,#PB_Ignore,WindowWidth(0)-20,#PB_Ignore)
ResizeGadget(0,#PB_Ignore,#PB_Ignore,WindowWidth(0)-20,#PB_Ignore)
ResizeGadget(11,#PB_Ignore,#PB_Ignore,WindowWidth(0)-20,#PB_Ignore)
ResizeGadget(1,#PB_Ignore,#PB_Ignore,WindowWidth(0)-20,#PB_Ignore)
ResizeGadget(12,#PB_Ignore,#PB_Ignore,WindowWidth(0)-20,#PB_Ignore)
ResizeGadget(2,#PB_Ignore,#PB_Ignore,WindowWidth(0)-20,#PB_Ignore)
EndProcedure
Text$ = "Test for vertical centered text - horizontal (above) or right aligned (below)..."
OpenWindow(0,0,0,300,200,"Edit Control VCenter",#PB_Window_SystemMenu| #PB_Window_MinimizeGadget| #PB_Window_MaximizeGadget| #PB_Window_SizeGadget| #PB_Window_ScreenCentered)
fHeight("Georgia",12)
ContainerGadget(10,10,10,280,40,#PB_Container_Flat)
StringGadget(0,0,GadgetHeight(10)/2-hh/2,280,hh,Text$,#ES_LEFT|#PB_String_BorderLess)
SetGadgetFont(0,FontID(fID))
setcolor(10,0,0,$0000FF)
CloseGadgetList()
fHeight("Tahoma",8)
ContainerGadget(11,10,60,280,40,#PB_Container_Flat)
StringGadget(1,0,GadgetHeight(11)/2-hh/2,280,hh,Text$,#ES_CENTER|#PB_String_BorderLess)
SetGadgetFont(1,FontID(fID))
setcolor(11,1,$B2EEFE,$00FF00)
CloseGadgetList()
fHeight("Consolas",14)
ContainerGadget(12,10,110,280,40,#PB_Container_Flat)
StringGadget(2,0,GadgetHeight(12)/2-hh/2,280,hh,Text$,#ES_RIGHT|#PB_String_BorderLess)
SetGadgetFont(2,FontID(fID))
setcolor(12,2,$D3FEFC,$FF0000)
CloseGadgetList()
BindEvent(#PB_Event_SizeWindow,@SizeCB())
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
Case #PB_Event_Gadget
Select EventGadget()
Case 0,1,2
Select EventType()
EndSelect
EndSelect
EndSelect
ForEver