共用方式為


CStatusBar::SetPaneText

Call this member function to set the pane text to the string pointed to by lpszNewText.

BOOL SetPaneText(
   int nIndex,
   LPCTSTR lpszNewText,
   BOOL bUpdate = TRUE 
);

Parameters

  • nIndex
    Index of the pane whose text is to be set.

  • lpszNewText
    Pointer to the new pane text.

  • bUpdate
    If TRUE, the pane is invalidated after the text is set.

Return Value

Nonzero if successful; otherwise 0.

Remarks

After you call SetPaneText, you must add a UI update handler to display the new text in the status bar.

Example

//Sets and displays text for pane index 3 and id ID_INDICATOR_SCRL
m_wndStatusBar.SetPaneText(3, _T("My New Status Bar Text"), TRUE);
//UI handler in the message map updates the status bar text:
ON_UPDATE_COMMAND_UI(ID_INDICATOR_SCRL, &CMainFrame::OnUpdatePane)
void CMainFrame::OnUpdatePane(CCmdUI* pCmdUI)
{
   pCmdUI->Enable();
}

Requirements

Header: afxext.h

See Also

Concepts

CStatusBar Class

CStatusBar Members

Hierarchy Chart

CStatusBar::GetPaneText