' See the README.TXT file for more information or just look through the code!
'
Type RECT
Left As Integer
Top As Integer
Right As Integer
Bottom As Integer
End Type
Type PanelStyleType
iLeft As Integer 'Left Position of the panel
iTop As Integer 'Top position of the panel
iWidth As Integer 'Width of the panel
iHeight As Integer 'Height of the Panel
iBorderStyle As Integer 'Type of panel 0-Recessed, 1-Raised, 2-Flat: User Defined
iFormat As Integer 'Format of the panel - Text, Date, Time, etc...: User Defined
iTextFormat As Integer 'Format of Text in the panel VCENTER, CENTER, etc.: User Defined
iOther As Integer 'Used for Icon Information or Percentage in the Meter Bar
lOther As Long 'User for color of the meter bar or whatever else needs to be used
End Type
Type PanelType
sCaption As String 'Caption contained in the panel
PanelStyle As PanelStyleType 'Panel Information
iFontBold As Integer 'Whether or not font is bold
iFont3D As Integer 'Whether or not font is 3D
sFontName As String 'Font Name - Defaults to statusbar setting
sFontSize As String 'Font Size - Defaults to statusbar setting
lFontColor As Long 'Font Color - Defaults to statusbar setting
bVisible As Integer 'Let's you hide or show any panel you wish
End Type
Type DrawProperties
lBackColor As Long
iDrawMode As Integer
iDrawStyle As Integer
iDrawWidth As Integer
lFillColor As Long
iFillStyle As Integer
bFontBold As Integer
bFontItalic As Integer
sFontName As String * 30
sFontSize As String * 10
bFontStrikeThru As Integer
bFontTransparent As Integer
bFontUnderline As Integer
lForeColor As Long
iScaleMode As Integer
End Type
'Constants for the DrawText API call
Global Const DT_TOP = &H0
Global Const DT_LEFT = &H0
Global Const DT_CENTER = &H1
Global Const DT_RIGHT = &H2
Global Const DT_VCENTER = &H4
Global Const DT_BOTTOM = &H8
Global Const DT_WORDBREAK = &H10
Global Const DT_SINGLELINE = &H20
Global Const DT_EXPANDTABS = &H40
Global Const DT_TABSTOP = &H80
Global Const DT_NOCLIP = &H100
Global Const DT_EXTERNALLEADING = &H200
Global Const DT_CALCRECT = &H400
Global Const DT_NOPREFIX = &H800
Global Const DT_INTERNAL = &H1000
'Types of panels
Global Const SBAR_PANEL_RECESSED = 0
Global Const SBAR_PANEL_RAISED = 1
Global Const SBAR_PANEL_FLAT = 2
'Format of the panels
Global Const SBAR_TEXT = 0 'Panel just contains text
Global Const SBAR_DATE = 1 'Panel contains the date
Global Const SBAR_TIME = 2 'Panel contains the time
Global Const SBAR_WEEKDAY = 3 'Panel contains the weekday
Global Const SBAR_FULLDATE = 4 'Panel Shows date as Tuesday Jan 1, 1995
Global Const SBAR_CAPSLOCK = 5 'Panel is a CAPLOCK toggle display
Global Const SBAR_NUMLOCK = 6 'Panel is a NUMLOCK toggle display
Global Const SBAR_SCROLL = 7 'Panel is a SCROLL LOCK toggle display
Global Const SBAR_COUNTER = 8 'Panel is a counter display
Global Const SBAR_FIXEDTEXT = 9 'Panel contains a fixed text
Global Const SBAR_MINICON = 10 'Panel is a miniature icon display
Global Const SBAR_ICONMIX = 11 'Panel is a miniature icon/text display
Global Const SBAR_BUTTON = 12 'Panel will emulate a button and fire and event when clicked
Global Const SBAR_METER = 13 'Panel is a meter control that displays progress
'Specific information for drawing the panels
Global Const SBAR_BORDERSIZE = 3 'Space between StatusBar borders and panels in pixels
Global Const SBAR_PANELGAP = 4 'Gap between panels
Global Const SBAR_TEXTGAP = 1 'Gap in between the text and the border in pixels
Global Const SBAR_METERWIDTH = 100 'Width in pixels of the Meter panel
'Some colors
Global Const SBAR_WHITEBORDER = &HFFFFFF 'For 3D Effect - White Bar
Global Const SBAR_DGREYBORDER = &H808080 'For 3D Effect - Drk Grey Bar
Global Const SBAR_BACKGROUND = &HC0C0C0 'Color to paint the picture box
Global Const SBAR_FONTCOLOR = &H0 'Black forecolor to draw text
'Virtual Keys definitions for the GetKeyState API
Global Const KEY_NUMLOCK = &H90
Global Const KEY_SCROLL = &H91
Global Const KEY_CAPITAL = &H14 'Caplocks Key
Declare Function GetKeyState Lib "User" (ByVal nVirtKey As Integer) As Integer
Declare Function DrawText Lib "User" (ByVal hDC As Integer, ByVal lpStr As String, ByVal nCount As Integer, lpRect As RECT, ByVal wFormat As Integer) As Integer
Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
Global Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Global Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest
Global Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest
Global Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest
Global Const SRCERASE = &H440328 ' (DWORD) dest = source AND (NOT dest )
Global Const NOTSRCCOPY = &H330008 ' (DWORD) dest = (NOT source)
Global Const NOTSRCERASE = &H1100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
Global Const MERGECOPY = &HC000CA ' (DWORD) dest = (source AND pattern)
Global Const MERGEPAINT = &HBB0226 ' (DWORD) dest = (NOT source) OR dest
Global Const PATCOPY = &HF00021 ' (DWORD) dest = pattern
Global Const PATPAINT = &HFB0A09 ' (DWORD) dest = DPSnoo
Global Const PATINVERT = &H5A0049 ' (DWORD) dest = pattern XOR dest
Global Const DSTINVERT = &H550009 ' (DWORD) dest = (NOT dest)
Global Const BLACKNESS = &H42& ' (DWORD) dest = BLACK
Global Const WHITENESS = &HFF0062 ' (DWORD) dest = WHITE
'Sub CreatePanels ()
'Use this procedure to create the panels you want...
'Call it from the Form_Load() Event...
'For use in multiple forms, cut and paste this into the general declarations section of
'each form. See the README.TXT file for more information.
'Calculate the space left over for all SBAR_TEXT types
iPTextWidth% = 0
If iNumTextPanels% > 0 Then
If iLeftOverSpace% > 0 Then iPTextWidth% = iLeftOverSpace% \ iNumTextPanels%
End If
'OK, now set our starting position to place our panels.
iLeftPos% = SBAR_BORDERSIZE
For iCnt% = 1 To iMaxPanels%
If puPanels(iCnt%).bVisible Then
'If this panel is SBAR_TEXT then set the width from our calculations
If puPanels(iCnt%).PanelStyle.iFormat = SBAR_TEXT Or puPanels(iCnt%).PanelStyle.iFormat = SBAR_ICONMIX Then puPanels(iCnt%).PanelStyle.iWidth = iPTextWidth%