Solved

RichEdit Font

Posted on 1998-05-14
5
679 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Event ID 10010 3 59
Need example 5 113
Printing text with Windows Picture Manager. 18 86
Interview questions for support of a legacy ASP.NET site 4 56
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…

815 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

11 Experts available now in Live!

Get 1:1 Help Now