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


LVL 6
WxWAsked:
Who is Participating?
 
Tommy HuiConnect With a Mentor EngineerCommented:
You can use WM_SETFONT for to set the font too.
0
 
Tommy HuiEngineerCommented:
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);


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

0
 
WxWAuthor Commented:
Basically I do not find any HFONT - relative entry in the CHARFORMAT structure ....
0
 
WxWAuthor Commented:
Um - You were right I found it in CharFormat2
Please send an answer so I award it
And Thanks

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.