CRichEditCtrl::GetSel

检索当前选择的区域本 CRichEditCtrl 对象的。

void GetSel(
   CHARRANGE& cr 
) const;
void GetSel(
   long& nStartChar,
   long& nEndChar 
) const;

参数

  • cr
    CHARRANGE 结构接收当前选择的区域。

  • nStartChar
    第一个字符的从零开始的索引在当前选定的。

  • nEndChar
    最后一个字符的从零开始的索引在当前选定的。

备注

此功能的两种形式提供备选方式获取选定内容的区域。 这些窗体的简要说明如下:

  • GetSel( cr ) 此窗体使用 CHARRANGE 结构与其 cpMincpMax 成员返回区域。

  • GetSel( nStartChar**,** nEndChar ) 此窗体返回在参数 nStartChar 和 nEndChar的区域。

选定内容web服务器,如果开头(cpMin 或 nStartChar)是0和末尾(cpMax 或 nEndChar)为– 1。

有关更多信息,请参见 EM_EXGETSEL 消息和 CHARRANGE 结构。Windows SDK。

示例

// Set the selection to be all characters after the current selection.
long nStartChar, nEndChar;

m_myRichEditCtrl.GetSel(nStartChar, nEndChar); 
m_myRichEditCtrl.SetSel(nEndChar, -1);

要求

Header: afxcmn.h

请参见

参考

CRichEditCtrl选件类

层次结构图

CRichEditCtrl::SetSel

CRichEditCtrl::GetSelText

CRichEditCtrl::GetParaFormat

CRichEditCtrl::GetSelectionCharFormat