Solved

RichEdit Font

Posted on 1998-05-14
5
677 Views
Last Modified: 2013-12-03
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
Comment
Question by:WxW
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1401552
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
 
LVL 6

Author Comment

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

0
 
LVL 6

Author Comment

by:WxW
ID: 1401554
Basically I do not find any HFONT - relative entry in the CHARFORMAT structure ....
0
 
LVL 6

Author Comment

by:WxW
ID: 1401555
Um - You were right I found it in CharFormat2
Please send an answer so I award it
And Thanks

0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 40 total points
ID: 1401556
You can use WM_SETFONT for to set the font too.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now