Panel, Panels Objects

Purpose

A Panels object is a collection of Panel objects. A Panel object represents an individual panel in the Panels collection of a StatusBar control.

Syntax

StatusBar.Panels

StatusBar.Panels.Panel(index)

StatusBar.Panel(index)

index:Variant

Description

Use the Panels collection to retrieve, add, or remove an individual Panel object.

The StatusBar.Panels property returns a reference to the Panels object, a collection of Panel objects.

StatusBar.Panels.Panel(index) returns a reference to the Panel with the given index (integer or string).

StatusBar.Panel(index) is a shortcut for the above.

A Panel object can contain text and a bitmap which may be used to reflect the status of an application.

To change the look of a panel, change the properties of the Panel object. To modify the properties at run-time, you can change the Panel object properties in code.

The Panels properties and methods:

Add | Clear | Count | Item | Remove

The Panel properties and methods:

Alignment | AutoSize | Index | Key | Left | MinWidth | Text | Style | Tag | ToolTipText | Top | Value | Width

Panel only properties

AutoSize returns or sets a value that determines the width of a Panel object after the StatusBar control has been resized.

0 (Default) None. No autosizing occurs. The width of the Panel is always and exactly that specified by the Width property.
1 Spring. When the parent form resizes and there is extra space available, all panels with this setting divide the space and grow accordingly. However, the panels' width never falls below that specified by the MinWidth property.
2 Content. The Panel is resized to fit its contents, however, the width will never fall below the width specified by the MinWidth property. Panel objects with the Content style have precedence over those with the Spring style. This means that a Spring-style Panel is shortened if a Panel with the Contents style requires that space.

MinWidth returns or sets the minimum width of a StatusBar control's Panel object. The MinWidth property is used when the AutoSize property is set to Contents or Spring, to prevent the panel from autosizing to a width that is too small. When the AutoSize property is set to 0, the MinWidth property is always set to the same value as the Width property.

The default value is the same as the default of the Width property. The value argument uses the same scale units as the scale mode of the parent form.

Example

Global Enum sbrNoAutoSize = 0, sbrSpring, sbrContents

Ocx StatusBar sb

sb.Panels.Add , , "Hello" : sb.Panel(1).AutoSize = sbrNoAutoSize

sb.Add , , "Hello" : sb.Panel(2).AutoSize = sbrSpring

sb.Panels.Add , , "Hello" : sb.Panel(3).AutoSize = sbrContents

sb.Add , , "Hello" : sb(4).MinWidth = 50 : sb(4).AutoSize = sbrContents

Do : Sleep  : Until Me Is Nothing

See Also

StatusBar

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}