CRichEdit小记

使用前要AfxInitRichEdit2();

修改背景颜色和字体颜色

    CRichEditCtrl* p=(CRichEditCtrl*)GetDlgItem(IDC_RICHEDIT21);

    CHARFORMAT2 cf;
    memset((char*)&cf,0,sizeof(cf));
    COLORREF color;
    color = RGB(0,255,0);
    cf.dwMask = CFM_COLOR;
    cf.crTextColor = color; //The text color
    cf.cbSize = sizeof(CHARFORMAT2);
    p->SendMessage(EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf );
    p->SetBackgroundColor(FALSE,RGB(0,0,0));

 

posted @ 2014-02-18 05:24  cavehubiao  阅读(389)  评论(0)    收藏  举报