Solved

RichEdit Font

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…

920 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

12 Experts available now in Live!

Get 1:1 Help Now