Link to home
Start Free TrialLog in
Avatar of WxW
WxW

asked on

RichEdit Font

I need to change the font used by a RichEdit . What's the procedure ? (Basically I need to change only the font size)

Also do you have any idea why EM_SETSEL(-1,-1) selects all the text , instead putting the cursor at the end ? ( I use RichEdit 2.0 )

Thanks


Avatar of Tommy Hui
Tommy Hui

Declare a CFont member in your class (Note that the lifetime of the font must be as long as the richedit). Then you can use richedit.SetFont(&m_Font); to change the font for all of the characters.

You can also use EM_SETCHARFORMAT to change a selection's font to something.

If you want to move the caret to the end, use

  int length = GetWindowTextLength();
  EM_SETSEL(length, length);


 
Avatar of WxW

ASKER

No I need the API procedure , because I have created the rich edit control using the Windows API and not visual objects | classes

Avatar of WxW

ASKER

Basically I do not find any HFONT - relative entry in the CHARFORMAT structure ....
Avatar of WxW

ASKER

Um - You were right I found it in CharFormat2
Please send an answer so I award it
And Thanks

ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial