Condividi tramite


Methods of Creating a Status Bar

MFC provides two classes to create status bars: CStatusBar and CStatusBarCtrl (which wraps the Windows common control API). CStatusBar provides all of the functionality of the status bar common control, it automatically interacts with menus and toolbars, and it handles many of the required common control settings and structures for you; however, your resulting executable usually will be larger than that created by using CStatusBarCtrl.

CStatusBarCtrl usually results in a smaller executable, and you may prefer to use CStatusBarCtrl if you do not intend to integrate the status bar into the MFC architecture. If you plan to use CStatusBarCtrl and integrate the status bar into the MFC architecture, you must take additional care to communicate status bar control manipulations to MFC. This communication is not difficult; however, it is additional work that is unneeded when you use CStatusBar.

Visual C++ provides two ways to take advantage of the status bar common control.

Either method will give you access to the member functions of the status bar control. When you call CStatusBar::GetStatusBarCtrl, it returns a reference to a CStatusBarCtrl object so you can use either set of member functions. See CStatusBar for information on constructing and creating a status bar using CStatusBar.

See Also

Reference

Using CStatusBarCtrl

Concepts

Controls (MFC)