[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 684
  • Last Modified:

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


0
WxW
Asked:
WxW
  • 3
  • 2
1 Solution
 
Tommy HuiCommented:
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
 
Tommy HuiCommented:
You can use WM_SETFONT for to set the font too.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now