Udostępnij za pośrednictwem


Status Bar Implementation in MFC

A CStatusBar object is a control bar with a row of text output panes. The output panes are commonly used as message lines and as status indicators. Examples include the menu help-message lines that briefly explain the selected menu command and the indicators that show the status of the SCROLL LOCK, NUM LOCK, and other keys.

As of MFC version 4.0, status bars are implemented using class CStatusBarCtrl, which encapsulates a status bar common control. For backward compatibility, MFC retains the older status bar implementation in class COldStatusBar. The documentation for earlier versions of MFC describes COldStatusBar under CStatusBar.

CStatusBar::GetStatusBarCtrl, a member function new to MFC 4.0, allows you to take advantage of the Windows common control's support for status bar customization and additional functionality. CStatusBar member functions give you most of the functionality of the Windows common controls; however, when you call GetStatusBarCtrl, you can give your status bars even more of the characteristics of a status bar. When you call GetStatusBarCtrl, it will return a reference to a CStatusBarCtrl object. You can use that reference to manipulate the status bar control.

The following figure shows a status bar that displays several indicators.

A Status Bar

Status Bar

Like the toolbar, the status-bar object is embedded in its parent frame window and is constructed automatically when the frame window is constructed. The status bar, like all control bars, is destroyed automatically as well when the parent frame is destroyed.

What do you want to know more about?

See Also

Concepts

Status Bars