SbrPanel class
One panel of a StatusBar: what it shows, its look, its place and its width. A program gets one from the SbrPanels collection, and from that collection’s Add method. It cannot make an SbrPanel object with New.
Dim Panel As SbrPanel
Set Panel = StatusBar1.Panels.Add(, "pos", "Ln 1")
Panel.Alignment = SbrPanelAlignmentCenter
Panel.Bold = True
Panel.ToolTipText = "The line of the caret"
Debug.Print Panel.Text; Panel.Index
' Output:
' Ln 1 2
The properties that give a panel a place and a width are in The width of a panel of the control’s page.
Properties
Alignment
Where the panel puts its text and its picture. A member of SbrPanelAlignmentConstants. Default: SbrPanelAlignmentLeft.
A value that is not a member raises run-time error 380.
AutoSize
How the panel’s width is decided. A member of SbrPanelAutoSizeConstants. Default: SbrPanelAutoSizeNone. A value that is not a member raises run-time error 380. See The width of a panel.
Bevel
The border of the panel. A member of SbrPanelBevelConstants. Default: SbrPanelBevelInset. A value that is not a member raises run-time error 380.
Bold
Whether the panel’s text is drawn in a bold form of the control’s Font. Boolean. Default: False.
DTFormat
The format of the date and the time that a panel of the styles SbrPanelStyleTime, SbrPanelStyleDate and SbrPanelStyleDateTime shows. A member of SbrPanelDTFormatConstants. Default: SbrPanelDTFormatShort. A value that is not a member raises run-time error 380. With SbrPanelDTFormatCustom the panel’s Text is the format string, as the Format function takes it.
Enabled
Whether the panel’s text is drawn as enabled, in ForeColor, or in the gray of disabled text with a dimmed picture. Boolean. Default: True. A panel whose Style shows the name of a key follows the key instead, see What a panel shows.
ForeColor
The color of the panel’s text. OLE_COLOR. Default: vbButtonText.
Index
The number of the panel in the bar, from 1. Long, read-only. It changes when a panel is added or removed before this one.
Key
The key of the panel in the SbrPanels collection. String. Empty for a panel without a key.
An assignment gives the panel another key, and the collection no longer finds it by the old one. An empty string takes the key away. A key that another panel has raises run-time error 457, and the panel keeps its key.
Left
The distance from the left edge of the control to the left edge of the panel, in the scale units of the control’s container. Single, read-only.
An assignment raises run-time error 383.
MinWidth
The width the panel does not go below, in the scale units of the control’s container. Single. Default: 96 device-independent pixels, which is 1440 twips.
A negative value raises run-time error 380.
Picture
The picture the panel shows beside its text, an icon or a bitmap. An IPictureDisp. Default: Nothing. The bar becomes as high as its tallest picture needs, if that is higher than its text. A panel with AutoSize set to content is wider by the picture.
PictureIndent
Space beside the picture, in the scale units of the control’s container. Single. Default: 0. A negative value raises run-time error 380. It adds to the width of a panel whose AutoSize is content.
PictureOnRight
Whether the picture is at the right of the text. Boolean. Default: False, with which it is at the left.
Style
What the panel shows. A member of SbrPanelStyleConstants. Default: SbrPanelStyleText. A value that is not a member raises run-time error 380. See What a panel shows.
Tag
A value of the program’s own, which the bar does not use. Variant: unlike the Tag of a control it holds a value of any type, an object included, which is assigned with Set.
A new panel has an empty string.
Text
The text of the panel. String. Default: empty. It is the default member.
A panel whose Style is not SbrPanelStyleText draws something else but still returns the string that was assigned. With a custom DTFormat that string is the format.
TextIndent
Space between the panel’s edge and its text, in the scale units of the control’s container: at the left edge for a left-aligned text, at the right edge for a right-aligned one. Single. Default: 0. A negative value raises run-time error 380. It has no effect on centered text, and it adds to the width of a panel whose AutoSize is content.
ToolTipText
The text shown in a small window when the pointer rests on the panel. String. Default: empty. It shows only while the bar’s ShowTips is True.
Visible
Whether the panel is shown. Boolean. Default: True.
A panel that is not visible has a Width of 0, and the panels after it move up.
Width
The width of the panel as it is drawn, in the scale units of the control’s container. Single. What an assignment does depends on AutoSize.
With SbrPanelAutoSizeNone the value becomes the panel’s width, and -1 gives the panel MinWidth again. With SbrPanelAutoSizeContent the value becomes MinWidth. With SbrPanelAutoSizeSpring an assignment has no effect. A value below 0 raises run-time error 380, except the -1 that is allowed with SbrPanelAutoSizeNone.