CStatusBarCtrl::GetText

从状态栏控件的特定部分检索文本。

CString GetText(
   int nPane,
   int* pType = NULL
) const;
int GetText(
   LPCTSTR lpszText,
   int nPane,
   int* pType = NULL 
) const;

参数

  • lpszText
    接收该文本缓冲区的地址。 此参数是一个Null终止的字符串。

  • nPane
    检索的文本的部分从零开始的索引。

  • pType
    为接收类型信息的整数的指针。 该类型可以是以下值之一:

    • 0 该文本比状态栏的平面绘制带有边框显示较低。

    • SBT_NOBORDERS 该文本绘制,没有边框。

    • SBT_POPOUT 该文本高于状态栏的平面绘制带有边框显示。

    • SBT_OWNERDRAW,如果文本具有 SBT_OWNERDRAW 绘图类型,pType 收到此消息并返回该32位值与该文本而不是长度和操作类型。

返回值

长度,在字符包含当前的文本,文本或 CString

示例

int nType;
TCHAR* pszPaneOneText;

pszPaneOneText = new TCHAR[ m_wndSBC.GetTextLength(1, &nType) + 1 ];
int nTextLength = m_wndSBC.GetText(pszPaneOneText, 1, &nType);

switch(nType)
{
   case 0:
      // Text is drawn with a border to appear lower than the 
      // plane of the status bar
      break;
   case SBT_NOBORDERS:
      // text is drawn without borders
      break;
   case SBT_OWNERDRAW:
      // Text is drawn by the parent window
      break;
   case SBT_POPOUT:
      // Text is drawn with a border to appear higher than the 
      // plane of the status bar
      break;
}   

delete pszPaneOneText;

要求

Header: afxcmn.h

请参见

参考

CStatusBarCtrl选件类

层次结构图

CStatusBarCtrl::SetText

CStatusBarCtrl::GetTextLength