CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Location
    Málaga - Spain
    Posts
    393

    How to change the font in RichEditCtrl

    Hi,

    I would like to change the default font of my richedit control, how can I do that ?

    Thanks, Bye !
    Braulio

    Rate this post if helped.

  2. #2
    Join Date
    May 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    2

    Re: How to change the font in RichEditCtrl

    Just define a CFont variable, and use CreatePointFont and SetFont. An example:


    CFont myFont;
    CRichEditCtrl editWnd; // or whatever class

    myFont.CreatePointFont(120, "Courier New");
    editWnd.SetFont(&edfont, TRUE);




    The first value of CreatePointFont is the font size times 10, so 120 = 12 point font.

    Hope that helps!

    - fogel


  3. #3
    Join Date
    Aug 2001
    Location
    Israel
    Posts
    60
    Another solution:

    VERIFY(m_Font.CreateFont(
    16, // nHeight
    0, // nWidth
    0, // nEscapement
    0, // nOrientation
    FW_NORMAL, // nWeight
    FALSE, // bItalic
    FALSE, // bUnderline
    0, // cStrikeOut
    ANSI_CHARSET, // nCharSet
    OUT_DEFAULT_PRECIS, // nOutPrecision
    CLIP_DEFAULT_PRECIS, // nClipPrecision
    DEFAULT_QUALITY, // nQuality
    DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
    "Levenim MT")); // lpszFacename

    m_MyRichEditCtrl.SetFont(&m_Font, TRUE);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured