CRichEditView::GetCharFormatSelection

调用此函数获取当前选择的字符格式设置属性。

CHARFORMAT2& GetCharFormatSelection( );

返回值

包含当前选择的字符格式设置属性的 CHARFORMAT2 结构。

备注

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

示例

void CMyRichEditView::OnCharUnderline ()
{
    CHARFORMAT2 cf;
    cf = GetCharFormatSelection();

    if (!(cf.dwMask & CFM_UNDERLINE) || !(cf.dwEffects & CFE_UNDERLINE))
        cf.dwEffects = CFE_UNDERLINE;
    else
        cf.dwEffects = 0;

    cf.dwMask = CFM_UNDERLINE;
    SetCharFormat(cf);
}

要求

Header: afxrich.h

请参见

参考

CRichEditView选件类

层次结构图

CRichEditView::SetCharFormat

CRichEditView::GetParaFormatSelection

CRichEditCtrl::GetSelectionCharFormat