如何改变RichEdit控件里面的字体风格

解决方案 »

  1.   

    先定义一个CFont,
    再调用CRichEditCtrl::SetFont()和其它更改字体没什么区别!
      

  2.   

    CWnd::SetFont
    void SetFont( CFont* pFont, BOOL bRedraw = TRUE );ParameterspFontSpecifies the new font.bRedrawIf TRUE, redraw the CWnd object.ResSets the window’s current font to the specified font. If bRedraw is TRUE, the window will also be redrawn.
      

  3.   

    定义一个成员变量 CFont m_font;
    在InitDialog或窗口建立时加入如下代码:m_font.CreatePointFont(400, _T("宋体")); // 建立字体
    GetDlgItem(IDC_RICHEDIT1)->SetFont(&m_font);//设RichEdit的字体注意,在RichEdit没有被Destory前,千万不要删除m_font,否则字体就白设了。