Option Explicit' SBPanel sample from BlackBeltVB.com
' http://blackbeltvb.com
'
' Written by Matt Hart
' Copyright 1999 by Matt Hart
'
' This software is FREEWARE. You may use it as you see fit for
' your own projects but you may not re-sell the original or the
' source code. Do not copy this sample to a collection, such as
' a CD-ROM archive. You may link directly to the original sample
' using "http://blackbeltvb.com/sbpanel.htm"
'
' No warranty express or implied, is given as to the use of this
' program. Use at your own risk.
'
' How to use any color or font you want in a statusbar.Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_USER = &H400
Private Const SB_GETRECT = (WM_USER + 10)Private Sub PanelText(sb As StatusBar, Index As Long, aText As String, bkColor As Long, fgColor As Long, lAlign As Integer)
    Dim R As RECT
    SendMessage sb.hwnd, SB_GETRECT, Index - 1, R
    With picPanel
        Set .Font = sb.Font
        .Move 0, 0, (R.Right - R.Left + 1) * Screen.TwipsPerPixelX, (R.Bottom - R.Top + 1) * Screen.TwipsPerPixelY
        .BackColor = bkColor
        .Cls
        .ForeColor = fgColor
        .CurrentY = (.Height - .TextHeight(aText)) \ 2
        Select Case lAlign
            Case 0      ' Left Justified
                .CurrentX = 0
            Case 1      ' Right Justified
                .CurrentX = .Width - .TextWidth(aText) - Screen.TwipsPerPixelX * 2
            Case 2      ' Centered
                .CurrentX = (.Width - .TextWidth(aText)) \ 2
        End Select
        picPanel.Print aText
        sb.Panels(Index).Text = aText
        sb.Panels(Index).Picture = .Image
    End With
End SubPrivate Sub Form_Load()
    StatusBar1.Font.Size = 10
    StatusBar1.Font.Bold = True
    PanelText StatusBar1, 1, "Panel Text", QBColor(1), QBColor(15), 1
    StatusBar1.Font.Size = 12
    StatusBar1.Font.Name = "Arial"
    PanelText StatusBar1, 2, Now, QBColor(0), QBColor(7), 2
End Sub