CREATING STATUS BARS FOR INDIVIDUAL FORMS WITH THE STATUSBAR CONTROL

The ActiveX StatusBar control is one of the easiest of the controls to use. It can be pretty passive and just show the date and time, if you want, or it can be updated constantly and give a good picture of what's now taking place.

The StatusBar control is used on the main form of WindowsCommonControls (see Figure 14.18).

Figure 14.18. The StatusBar control allows you to place a status bar on each form, if you want.


Like other ActiveX controls, the StatusBar control is partially made up of a collection. Some examples of collections used are the TabStrip control, which uses the Tabs collection, and the ImageList control, which uses the ListImages collection. The StatusBar control uses the Panels collection, which I examine in a moment. First, I discuss the overall properties used by the StatusBar control.

The StatusBar control doesn't use as many properties from the overall control as some of the other ActiveX controls. Table 14.5 shows a few properties that are used by the StatusBar control overall.

Table 14.5. Status Bar Properties
Property Description
Style Allows you to choose multiple panels (0 - Normal) or a single panel (1 - Simple)
SimpleText Sets the simple text displayed when the Style of 1 - Single Panel Simple Text is chosen
MousePointer Used the same as the other ActiveX controls, allowing you to choose which style to use for the mouse pointer

Properties of the StatusBar Panels Collection

The real power behind the StatusBar control lies in the Panels collection. With this collection, you can specify not only the number of panels to use, but also what style of information you want to display in each panel. This includes Text, Caps Lock status, Num Lock status, Date, Time, and more. Table 14.6 lists some useful properties for the StatusBar Panel object.

Table 14.6. The StatusBar Panel Object's Properties
Property Description
Index The current panel index; this property is read-only.
Text Text to be displayed; used when the Style property is set to 0 - Text.
Key As with other control collections, allows you to set a text value to refer to the current panel rather than to the index.
Alignment How you want to align the information in the current panel: 0 - Left, 1 - Center, or 2 - Right.
Style Style of information to be displayed: 0 - Text, 1 - Caps, 2 - Num Lock, 3 - Ins, 4 - Scroll, 5 - Time, 6 - Date, and 7 - Kana Lock (used for Asian characters).
Bevel The special effect you want to use with the panel: 0 - None, 1 - Inset, or 2 - Raised.
AutoSize How you want the size of the panel to be affected. 0 - None means no autosize, and the size stays at whatever the panel width is set. 1 - Spring changes the panel width with the width of the form. 2 - Contents matches the width of the panel with the width of the contents of the panel.
Picture A bitmap or icon.

You can set these properties at design time or runtime. The one most likely to be set at runtime is the Text property. Figure 14.19 shows the panel properties.

Figure 14.19. Each panel's properties can be set independently of each other.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.65.247