StatusBar Control
Provides a customizable status bar, supporting panel collections, simple/normal modes, a sizing grip, and OLE drag-and-drop. Cannot receive focus.
Enumerations
SbrStyleConstants
Status bar style constants.
| Constant | Value | Description |
|---|---|---|
| SbrStyleNormal | 0 | Normal mode (displays panels) |
| SbrStyleSimple | 1 | Simple mode (displays SimpleText only) |
SbrPanelStyleConstants
Panel style constants.
| Constant | Value | Description |
|---|---|---|
| SbrPanelStyleText | 0 | Text panel |
| SbrPanelStyleCaps | 1 | Caps Lock state |
| SbrPanelStyleNum | 2 | Num Lock state |
| SbrPanelStyleIns | 3 | Insert state |
| SbrPanelStyleScrl | 4 | Scroll Lock state |
| SbrPanelStyleTime | 5 | Time |
| SbrPanelStyleDate | 6 | Date |
| SbrPanelStyleKana | 7 | Kana state |
| SbrPanelStyleHangul | 8 | Hangul state |
| SbrPanelStyleJunja | 9 | Junja state |
| SbrPanelStyleFinal | 10 | Final state |
| SbrPanelStyleKanji | 11 | Kanji state |
| SbrPanelStyleHanja | 12 | Hanja state |
SbrPanelBevelConstants
Panel bevel style constants.
| Constant | Value | Description |
|---|---|---|
| SbrPanelBevelFlat | 0 | Flat |
| SbrPanelBevelInset | 1 | Inset |
| SbrPanelBevelRaised | 2 | Raised |
SbrPanelAutoSizeConstants
Panel auto-size constants.
| Constant | Value | Description |
|---|---|---|
| SbrPanelAutoSizeNone | 0 | No auto-size |
| SbrPanelAutoSizeSpring | 1 | Spring (fills remaining space) |
| SbrPanelAutoSizeContent | 2 | Size to content |
SbrPanelAlignmentConstants
Panel alignment constants.
| Constant | Value | Description |
|---|---|---|
| SbrPanelAlignmentLeft | 0 | Left aligned |
| SbrPanelAlignmentCenter | 1 | Center aligned |
| SbrPanelAlignmentRight | 2 | Right aligned |
| SbrPanelAlignmentLeftRight | 3 | Left-to-right aligned (RTL support) |
SbrPanelDTFormatConstants
Panel date/time format constants.
| Constant | Value | Description |
|---|---|---|
| SbrPanelDTFormatShort | 0 | Short format |
| SbrPanelDTFormatLong | 1 | Long format |
Properties
Name
Public Property Get Name() As StringReturns the name used to identify the object in code.
Tag
Public Property Get Tag() As String
Public Property Let Tag(ByVal Value As String)Stores extra data needed by the program.
Parent
Public Property Get Parent() As ObjectReturns the object that contains this object.
Container
Public Property Get Container() As Object
Public Property Set Container(ByVal Value As Object)Returns/sets the object's container.
Left
Public Property Get Left() As Single
Public Property Let Left(ByVal Value As Single)Returns/sets the distance between the object and the left edge of its container.
Top
Public Property Get Top() As Single
Public Property Let Top(ByVal Value As Single)Returns/sets the distance between the object and the top edge of its container.
Width
Public Property Get Width() As Single
Public Property Let Width(ByVal Value As Single)Returns/sets the width of the object.
Height
Public Property Get Height() As Single
Public Property Let Height(ByVal Value As Single)Returns/sets the height of the object.
Visible
Public Property Get Visible() As Boolean
Public Property Let Visible(ByVal Value As Boolean)Returns/sets whether the object is visible.
ToolTipText
Public Property Get ToolTipText() As String
Public Property Let ToolTipText(ByVal Value As String)Returns/sets the tooltip text displayed when the mouse hovers over the control.
WhatsThisHelpID
Public Property Get WhatsThisHelpID() As Long
Public Property Let WhatsThisHelpID(ByVal Value As Long)Returns/sets the associated context-sensitive help ID.
Align
Public Property Get Align() As Integer
Public Property Let Align(ByVal Value As Integer)Returns/sets the alignment of the control on its form.
DragIcon
Public Property Get DragIcon() As IPictureDisp
Public Property Let DragIcon(ByVal Value As IPictureDisp)
Public Property Set DragIcon(ByVal Value As IPictureDisp)Returns/sets the icon displayed during a drag-and-drop operation.
DragMode
Public Property Get DragMode() As Integer
Public Property Let DragMode(ByVal Value As Integer)Returns/sets the drag mode.
hWnd
Public Property Get hWnd() As LongPtrReturns the control handle.
hWndUserControl
Public Property Get hWndUserControl() As LongPtrReturns the UserControl handle.
Font
Public Property Get Font() As StdFont
Public Property Let Font(ByVal NewFont As StdFont)
Public Property Set Font(ByVal NewFont As StdFont)Returns/sets the font.
VisualStyles
Public Property Get VisualStyles() As Boolean
Public Property Let VisualStyles(ByVal Value As Boolean)Returns/sets whether visual styles are enabled. Requires comctl32.dll 6.0 or later.
Enabled
Public Property Get Enabled() As Boolean
Public Property Let Enabled(ByVal Value As Boolean)Returns/sets whether the object can respond to user-generated events.
OLEDropMode
Public Property Get OLEDropMode() As OLEDropModeConstants
Public Property Let OLEDropMode(ByVal Value As OLEDropModeConstants)Returns/sets whether the object can act as an OLE drop target.
MousePointer
Public Property Get MousePointer() As CCMousePointerConstants
Public Property Let MousePointer(ByVal Value As CCMousePointerConstants)Returns/sets the pointer type displayed when the mouse hovers over the control. See common enumerations.
MouseIcon
Public Property Get MouseIcon() As IPictureDisp
Public Property Let MouseIcon(ByVal Value As IPictureDisp)
Public Property Set MouseIcon(ByVal Value As IPictureDisp)Returns/sets the custom mouse icon.
MouseTrack
Public Property Get MouseTrack() As Boolean
Public Property Let MouseTrack(ByVal Value As Boolean)Returns/sets whether events are raised when the mouse enters or leaves the control.
RightToLeft
Public Property Get RightToLeft() As Boolean
Public Property Let RightToLeft(ByVal Value As Boolean)Returns/sets the right-to-left display direction.
RightToLeftLayout
Public Property Get RightToLeftLayout() As Boolean
Public Property Let RightToLeftLayout(ByVal Value As Boolean)Returns/sets the right-to-left layout.
RightToLeftMode
Public Property Get RightToLeftMode() As CCRightToLeftModeConstants
Public Property Let RightToLeftMode(ByVal Value As CCRightToLeftModeConstants)Returns/sets the right-to-left mode. See common enumerations.
Style
Public Property Get Style() As SbrStyleConstants
Public Property Let Style(ByVal Value As SbrStyleConstants)Returns/sets the status bar style.
SimpleText
Public Property Get SimpleText() As String
Public Property Let SimpleText(ByVal Value As String)Returns/sets the text displayed in simple mode.
AllowSizeGrip
Public Property Get AllowSizeGrip() As Boolean
Public Property Let AllowSizeGrip(ByVal Value As Boolean)Returns/sets whether the sizing grip is displayed.
ShowTips
Public Property Get ShowTips() As Boolean
Public Property Let ShowTips(ByVal Value As Boolean)Returns/sets whether tooltips are displayed.
BackColor
Public Property Get BackColor() As OLE_COLOR
Public Property Let BackColor(ByVal Value As OLE_COLOR)Returns/sets the background color.
DoubleBuffer
Public Property Get DoubleBuffer() As Boolean
Public Property Let DoubleBuffer(ByVal Value As Boolean)Returns/sets whether double-buffered drawing is enabled.
Panels
Public Property Get Panels() As SbrPanelsReturns the panels collection.
Methods
Refresh
Public Sub Refresh()Forces a complete redraw of the object.
IncludesSizeGrip
Public Function IncludesSizeGrip() As BooleanDetermines whether the status bar includes a sizing grip.
HitTest
Public Function HitTest(ByVal X As Single, ByVal Y As Single) As SbrPanelReturns the panel at the specified coordinates.
OLEDrag
Public Sub OLEDrag()Initiates an OLE drag-and-drop operation.
Drag
Public Sub Drag(Optional ByRef Action As Variant)Starts, ends, or cancels a drag operation.
ZOrder
Public Sub ZOrder(Optional ByRef Position As Variant)Sets the Z-order.
Events
Click
Public Event Click()Raised when the user clicks the control.
DblClick
Public Event DblClick()Raised when the user double-clicks the control.
StyleChange
Public Event StyleChange()Raised when the status bar style changes.
PanelClick
Public Event PanelClick(ByVal Panel As SbrPanel, ByVal Button As Integer)Raised when the user clicks a panel.
PanelDblClick
Public Event PanelDblClick(ByVal Panel As SbrPanel, ByVal Button As Integer)Raised when the user double-clicks a panel.
MouseDown
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)Raised when a mouse button is pressed.
MouseMove
Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Raised when the mouse is moved.
MouseUp
Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Raised when a mouse button is released.
MouseEnter
Public Event MouseEnter()Raised when the mouse enters the control area.
MouseLeave
Public Event MouseLeave()Raised when the mouse leaves the control area.
OLECompleteDrag
Public Event OLECompleteDrag(Effect As Long)Raised when an OLE drag-and-drop operation is completed.
OLEDragDrop
Public Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)Raised when an OLE drag-and-drop operation is dropped.
OLEDragOver
Public Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)Raised during an OLE drag-and-drop hover.
OLEGiveFeedback
Public Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)Raised when OLE drag-and-drop gives feedback.
OLESetData
Public Event OLESetData(Data As DataObject, DataFormat As Integer)Raised when OLE drag-and-drop sets data.
OLEStartDrag
Public Event OLEStartDrag(Data As DataObject, AllowedEffects As Long)Raised when an OLE drag-and-drop operation starts.
Sub-Objects
SbrPanel Class
Status bar panel object.
SbrPanel Properties
Index
Public Property Get Index() As LongThe index of the panel in the collection.
Key
Public Property Get Key() As String
Public Property Let Key(ByVal Value As String)The panel's unique identifier key.
Tag
Public Property Get Tag() As Variant
Public Property Let Tag(ByVal Value As Variant)
Public Property Set Tag(ByVal Value As Variant)Extra data.
Text
Public Property Get Text() As String
Public Property Let Text(ByVal Value As String)Panel text.
ToolTipText
Public Property Get ToolTipText() As String
Public Property Let ToolTipText(ByVal Value As String)ToolTip text.
Style
Public Property Get Style() As SbrPanelStyleConstants
Public Property Let Style(ByVal Value As SbrPanelStyleConstants)Panel style.
Bevel
Public Property Get Bevel() As SbrPanelBevelConstants
Public Property Let Bevel(ByVal Value As SbrPanelBevelConstants)Panel bevel style.
AutoSize
Public Property Get AutoSize() As SbrPanelAutoSizeConstants
Public Property Let AutoSize(ByVal Value As SbrPanelAutoSizeConstants)Panel auto-size behavior.
Alignment
Public Property Get Alignment() As SbrPanelAlignmentConstants
Public Property Let Alignment(ByVal Value As SbrPanelAlignmentConstants)Panel alignment.
DTFormat
Public Property Get DTFormat() As SbrPanelDTFormatConstants
Public Property Let DTFormat(ByVal Value As SbrPanelDTFormatConstants)Panel date/time format.
ForeColor
Public Property Get ForeColor() As OLE_COLOR
Public Property Let ForeColor(ByVal Value As OLE_COLOR)Foreground color.
MinWidth
Public Property Get MinWidth() As Single
Public Property Let MinWidth(ByVal Value As Single)Minimum width.
Picture
Public Property Get Picture() As IPictureDisp
Public Property Let Picture(ByVal Value As IPictureDisp)
Public Property Set Picture(ByVal Value As IPictureDisp)Panel picture.
Enabled
Public Property Get Enabled() As Boolean
Public Property Let Enabled(ByVal Value As Boolean)Whether enabled.
Visible
Public Property Get Visible() As Boolean
Public Property Let Visible(ByVal Value As Boolean)Whether visible.
Bold
Public Property Get Bold() As Boolean
Public Property Let Bold(ByVal Value As Boolean)Whether text is displayed in bold.
PictureOnRight
Public Property Get PictureOnRight() As Boolean
Public Property Let PictureOnRight(ByVal Value As Boolean)Whether the picture is displayed on the right side.
Left
Public Property Get Left() As SinglePanel left edge distance (read-only).
Width
Public Property Get Width() As Single
Public Property Let Width(ByVal Value As Single)Panel width.
SbrPanels Class
Status bar panels collection.
SbrPanels Members
NewEnum
Public Function NewEnum() As IEnumVARIANTEnumerator (hidden).
Add
Public Function Add(Optional ByVal Index As Long, Optional ByVal Key As String, Optional ByVal Text As String, Optional ByVal Style As SbrPanelStyleConstants) As SbrPanelAdds a panel.
Item
Public Property Get Item(ByVal Index As Variant) As SbrPanelGets a panel (default member).
Exists
Public Function Exists(ByVal Index As Variant) As BooleanChecks if a panel exists.
Count
Public Property Get Count() As LongPanel count.
Clear
Public Sub Clear()Clears all panels.
Remove
Public Sub Remove(ByVal Index As Variant)Removes a panel.
SbrPanelProperties Class
Internal panel properties object.
SbrPanelProperties Properties
ForeColor
Public Property Get ForeColor() As OLE_COLOR
Public Property Let ForeColor(ByVal Value As OLE_COLOR)Foreground color.
Code Examples
Basic Usage
' Add status bar panels
With StatusBar1.Panels
.Add , "Status", "Ready", sbrText
.Add , "Caps", , sbrCaps
.Add , "Time", , sbrTime
End With
' Customize panel style
With StatusBar1.Panels(1)
.AutoSize = sbrSpring
.Bevel = sbrInset
End With
' Switch to simple mode
StatusBar1.Style = sbrSimple
StatusBar1.SimpleText = "Loading data..."
' Handle panel click
Private Sub StatusBar1_PanelClick(ByVal Panel As SbrPanel, ByVal Button As Integer)
Debug.Print "Panel clicked: " & Panel.Key
End Sub