- StatusBar height
- Colored text - Font - Background
- Control text position
- Icons
- Field tips
Edit :
For 2nd. snippet you can use
#DT_BOTTOM ,#DT_TOP ,#DT_LEFT ,#DT_CENTER ,#DT_RIGHT And #DT_VCENTER with #DT_SINGLELINE
as flags to control the position of the text
Code: Select all
Global hSB,iinf.ICONINFO ,icoHnd
Global Dim Fields(2)
Fields(0) = 150
Fields(1) = 190
Fields(2) = 390
iinf\fIcon = 1
#SBT_TOOLTIPS = $800
#SB_SETICON = #WM_USER + 15
Procedure dtext(img,font,text$,x,y,w,h,fcolor,bcolor)
CreateImage(img,w,h,24,bcolor)
StartDrawing(ImageOutput(img))
DrawingFont(FontID(font))
DrawingMode(#PB_2DDrawing_Transparent )
DrawText(x,y,text$,fcolor)
StopDrawing()
iinf\hbmMask = ImageID(img)
iinf\hbmColor = ImageID(img)
icoHnd = CreateIconIndirect_(iinf)
FreeImage(img)
ProcedureReturn icoHnd
EndProcedure
Procedure sizeCB()
MoveWindow_(hSB ,0,WindowY(0,#PB_Window_FrameCoordinate)+WindowHeight(0)-40,WindowWidth(0),40,1)
EndProcedure
LoadImage(0,#PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico")
LoadFont(0,"Tahoma",16)
LoadFont(1,"Georgia",16)
OpenWindow(0, 0, 0, 500, 200, "", #PB_Window_SystemMenu|#PB_Window_SizeGadget| #PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)
hSB = CreateWindowEx_(0,"msctls_statusbar32","",#SBARS_SIZEGRIP| #WS_CHILD|#WS_VISIBLE|#SBT_TOOLTIPS , 0, 0, 0, 0, WindowID(0),0,0,0)
SendMessage_(hSB, #SB_SETMINHEIGHT, 40, 0)
SendMessage_(hSB, #WM_SIZE, 0,0)
SendMessage_(hSB, #SB_SETPARTS, 3, @Fields())
dtext(10,0,"RASHAD",40,8,150,40,$0000FF,$FFFFFE)
SendMessage_(hSB, #SB_SETICON, 0, icoHnd)
SendMessage_(hSB, #SB_SETICON, 1, ImageID(0))
SendMessage_(hSB, #SB_SETTIPTEXT, 1, "ToolTip")
dtext(10,1,"RASHAD",50,8,200,40,$00F3F5,$F43401)
SendMessage_(hSB, #SB_SETICON, 2, icoHnd)
InvalidateRect_(WindowID(0),0,1)
BindEvent(#PB_Event_SizeWindow,@sizeCB())
Repeat
Select WaitWindowEvent(10)
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
Code: Select all
Global hSB,iinf.ICONINFO ,icoHnd,r.RECT
Global Dim Fields(2)
Fields(0) = 150
Fields(1) = 190
Fields(2) = 390
iinf\fIcon = 1
#SBT_TOOLTIPS = $800
#SB_SETICON = #WM_USER + 15
Procedure dtext(img,font,text$,x,y,w,h,fcolor,bcolor,flags)
CreateImage(img,w,h,24,bcolor)
hdc = StartDrawing(ImageOutput(img))
SelectObject_(hdc,FontID(font))
SetTextColor_(hdc,fcolor)
SetBkColor_(hdc,bcolor)
SetBkMode_(hdc,#TRANSPARENT )
r\left = x :r\top = y : r\right = w : r\bottom = h
DrawText_(hDC,@text$,Len(Text$),r , flags)
StopDrawing()
iinf\hbmMask = ImageID(img)
iinf\hbmColor = ImageID(img)
icoHnd = CreateIconIndirect_(iinf)
FreeImage(img)
ProcedureReturn icoHnd
EndProcedure
Procedure sizeCB()
MoveWindow_(hSB ,0,WindowY(0,#PB_Window_FrameCoordinate)+WindowHeight(0)-40,WindowWidth(0),40,1)
EndProcedure
LoadImage(0,#PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico")
LoadFont(0,"Tahoma",16)
LoadFont(1,"Georgia",18)
OpenWindow(0, 0, 0, 500, 200, "", #PB_Window_SystemMenu|#PB_Window_SizeGadget| #PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)
hSB = CreateWindowEx_(0,"msctls_statusbar32","",#SBARS_SIZEGRIP| #WS_CHILD|#WS_VISIBLE|#SBT_TOOLTIPS , 0, 0, 0, 0, WindowID(0),0,0,0)
SendMessage_(hSB, #SB_SETMINHEIGHT, 40, 0)
SendMessage_(hSB, #WM_SIZE, 0,0)
SendMessage_(hSB, #SB_SETPARTS, 3, @Fields())
dtext(10,0," RASHAD",0,0,150,40,$0000FF,$FFFFFE, #DT_LEFT |#DT_VCENTER | #DT_SINGLELINE )
SendMessage_(hSB, #SB_SETICON, 0, icoHnd)
SendMessage_(hSB, #SB_SETICON, 1, ImageID(0))
SendMessage_(hSB, #SB_SETTIPTEXT, 1, "ToolTip")
dtext(10,1,"RASHAD ",0,0,200,40,$00F3F5,$F43401,#DT_VCENTER |#DT_CENTER| #DT_SINGLELINE )
SendMessage_(hSB, #SB_SETICON, 2, icoHnd)
InvalidateRect_(WindowID(0),0,1)
BindEvent(#PB_Event_SizeWindow,@sizeCB())
Repeat
Select WaitWindowEvent(10)
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1