CMFCStatusBar Class

The CMFCStatusBar class implements a status bar similar to the CStatusBar class. However, the CMFCStatusBar class has features not offered by the CStatusBar class, such as the ability to display images, animations, and progress bars; and the ability to respond to mouse double-clicks.

class CMFCStatusBar : public CPane

Members

Public Methods

Name

Description

CMFCStatusBar::CalcFixedLayout

  (Overrides CBasePane::CalcFixedLayout.)

CMFCStatusBar::CommandToIndex

 

CMFCStatusBar::Create

Creates a control bar and attaches it to the CPane object. (Overrides CPane::Create.)

CMFCStatusBar::CreateEx

Creates a control bar and attaches it to the CPane object. (Overrides CPane::CreateEx.)

CMFCStatusBar::DoesAllowDynInsertBefore

Determines whether another pane can be dynamically inserted between this pane and the parent frame. (Overrides CBasePane::DoesAllowDynInsertBefore.)

CMFCStatusBar::EnablePaneDoubleClick

Enables or disables the handling of mouse double-clicks on the status bar.

CMFCStatusBar::EnablePaneProgressBar

Displays a progress bar on the specified pane.

CMFCStatusBar::GetCount

Returns the number of panes on the status bar.

CMFCStatusBar::GetDrawExtendedArea

 

CMFCStatusBar::GetExtendedArea

 

CMFCStatusBar::GetItemID

 

CMFCStatusBar::GetItemRect

 

CMFCStatusBar::GetPaneInfo

 

CMFCStatusBar::GetPaneProgress

 

CMFCStatusBar::GetPaneStyle

Returns the pane style. (Overrides CBasePane::GetPaneStyle.)

CMFCStatusBar::GetPaneText

 

CMFCStatusBar::GetPaneWidth

Returns the width, in pixels, of the specified pane of the status bar.

CMFCStatusBar::GetTipText

Returns the tool tip text for the specified pane of the status bar.

CMFCStatusBar::InvalidatePaneContent

Invalidates the specified pane and redraws its content.

CMFCStatusBar::PreCreateWindow

Called by the framework before the creation of the Windows window attached to this CWnd object. (Overrides CWnd::PreCreateWindow.)

CMFCStatusBar::SetDrawExtendedArea

 

CMFCStatusBar::SetIndicators

 

CMFCStatusBar::SetPaneAnimation

Assigns an animation to the specified pane.

CMFCStatusBar::SetPaneBackgroundColor

Sets the background color for the specified pane of the status bar.

CMFCStatusBar::SetPaneIcon

Sets the indicator icon for the specified pane of the status bar.

CMFCStatusBar::SetPaneInfo

 

CMFCStatusBar::SetPaneProgress

Sets the current progress of the progress bar for the specified pane of the status bar.

CMFCStatusBar::SetPaneStyle

Sets the style of the pane. (Overrides CBasePane::SetPaneStyle.)

CMFCStatusBar::SetPaneText

 

CMFCStatusBar::SetPaneTextColor

Sets the text color for the specified pane of the status bar.

CMFCStatusBar::SetPaneWidth

Sets the width in pixels of the specified pane of the status bar.

CMFCStatusBar::SetTipText

Sets the tool tip text for the specified pane of the status bar.

Protected Methods

Name

Description

CMFCStatusBar::OnDrawPane

Called by the framework when it redraws the pane of the status bar.

Remarks

The following diagram shows a figure of the status bar from Status Bar Demo sample application.

CMFCStatusBar Image

Example

The following example demonstrates the local variables that the application uses to call various methods in the CMFCStatusBar class. These variables are declared in StatusBarDemoView.h. The main frame is declared in MainFrm.h, the document is declared in StatusBarDemoDoc.h, and the view is declared in StatusBarDemoView.h. This code snippet is part of the Status Bar Demo sample.

    int         m_nProgressCurr;
    BOOL        m_bInProgress;

    CImageList  m_imlStatusAnimation;
    BOOL        m_bInAnimation;

    CBitmap     m_bmpIcon1;
    CBitmap     m_bmpIcon2;

The following example demonstrates how to get a reference to CMFCStatusBar object by introducing the GetStatusBar method in MainFrm.h and then calling this method from the GetStatusBar method in StatusBarDemoView.h. This code snippet is part of the Status Bar Demo sample.

// in MainFrm.h
public:
    CMFCStatusBar& GetStatusBar ()
    {
        return m_wndStatusBar;
    }


...


    // in StatusBarDemoView.h
    CMFCStatusBar& GetStatusBar () const
    {
        return ((CMainFrame*) AfxGetMainWnd ())->GetStatusBar ();
    }

The following example demonstrates how to call various methods in the CMFCStatusBar class in StatusBarDemoView.cpp. The constants are declared in MainFrm.h. The example shows how to set the icon, set the tooltip text of the status bar pane, display a progress bar on the specified pane, assign an animation to the specified pane, set the text and the width of the status bar pane, and set the current progress indicator of the progress bar for the status bar pane. This code snippet is part of the Status Bar Demo sample.

// in MainFrm.h
const int nStatusIcon = 0;
const int nStatusInfo = 1;
const int nStatusProgress = 2;
const int nStatusLabel = 3;
const int nStatusAnimation = 4;


...


    // in StatusBarDemoView.cpp
    GetStatusBar ().SetPaneIcon (nStatusIcon, m_bmpIcon1);
    GetStatusBar ().SetTipText (nStatusIcon, _T("This is a tooltip"));


...


    GetStatusBar ().EnablePaneProgressBar (nStatusProgress, PROGRESS_MAX);


...


        GetStatusBar ().SetPaneAnimation (nStatusAnimation, NULL);


...


    GetStatusBar ().SetPaneAnimation (nStatusAnimation, m_imlStatusAnimation);
    GetStatusBar ().SetPaneText (nStatusAnimation, _T(""));
    GetStatusBar ().SetPaneWidth (nStatusAnimation, 16);


...


        GetStatusBar ().SetPaneProgress (nStatusProgress, m_nProgressCurr);

Inheritance Hierarchy

CObject

   CCmdTarget

      CWnd

         CBasePane

            CPane

               CMFCStatusBar

Requirements

Header: afxstatusbar.h

See Also

Reference

Hierarchy Chart

CPane Class

CStatusBar Class

Other Resources

MFC Classes