CHARFORMAT cf;
m_Content.GetDefaultCharFormat(cf);  
cf.cbSize=10;
DWORD dwEffects = 0;
cf.dwEffects = dwEffects;
cf.dwMask = CFM_BOLD | CFM_COLOR|CFM_SIZE;
cf.crTextColor = RGB(255,0,0);
m_Content.SetDefaultCharFormat(cf);
m_Content.SetWindowText(l_svDisplayText);                            这样可以设置RichEdit中的字体颜色,但是所有文本颜色都改变!!

解决方案 »

  1.   

    还有设置选择的char的format
      

  2.   

                       我用了,但是颜色没有改变:
    CHARFORMAT cf;
    m_Content.GetDefaultCharFormat(cf);  
    cf.cbSize=10;
    DWORD dwEffects = 0;
    cf.dwEffects = dwEffects;
    cf.dwMask = CFM_BOLD | CFM_COLOR|CFM_SIZE;
    cf.crTextColor = RGB(255,0,0);
                                    m_Content.SetSel(1,7);
    m_Content.SetSelectionCharFormat(cf);
      

  3.   

    可以了,确实用的是SetSelectionCharFormat,谢谢!