Solved

RichEdit Control

Posted on 2000-03-14
8
460 Views
Last Modified: 2013-11-20
Hi,

I am trying to use a RichEdit Control on my dialog because I need to change the edit controls background colour...

I'd like the control to be read only, right aligned text and in Upper case only. I have tried to set these properties when in the reseource editor. I found that the read only checkbox worked but it disables the ability to change the alignment and the Uppercase checkbox doesn't do anything...

Is there another way of setting these properties.. I have looked through all the methods on the control and can't find any. Also is it possible to change the font size of the text being displayed..

thanks in advance..
0
Comment
Question by:middlel
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:captainkirk
ID: 2616645
Did you check the "multiline" property?
0
 
LVL 4

Accepted Solution

by:
captainkirk earned 102 total points
ID: 2616665
Also you can set the font:

CFont f;
f.CreateFont(<set your params for the font in here>);
m_RichEdit.SetFont(); // m_RichhEdit is your control...


be sure to call AfxInitRichEdit() in your app's InitInstance()...
0
 

Author Comment

by:middlel
ID: 2616814
I have made sure that the control is intialised, you can always tell if AfxInitRichEdit() hasn't been called because the dialog does not display. :-)
I don't want the edit control to have multiple lines, but when I tried it made no difference.

However, when I unchecked the automatic horizontal scroll, and the multiple lines state was also checked, the edit control aligned properly ... weird..

I still haven't figured out how to get the edit to display UPPERCASE no matter what is entered??

I'll try the font stuff..

thanks

0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 8

Expert Comment

by:gelbert
ID: 2616835
Overwrite OnChar() and convert every character to upper case there
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2616838
I missed a point here - if the rich edit is read only, just setting the uppercase property is not going to work, because, that only converts typed-in text to uppercase. If you use SetWindowText(), you'll do the conversion yourself, maybe like a variant of this:

CString csText = _T("here's some lowercase text...");
csText.MakeUpper();

m_RichEdit.SetWindowText(csText);
0
 

Author Comment

by:middlel
ID: 2616891
I get passed the text from somewhere else and I thought it would be nice if when I Set the text it would automatically just convert it... ;-)

I'll just add a check to make sure that it is uppercase..

Cheers!

Emma
0
 

Author Comment

by:middlel
ID: 2619210
It all works great now!

thanks a lot..

Emma
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2620161
glad you're doing OK...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 187
Change owner from userA to server Local Administrators 7 64
Best tools for Backup and restore of Wordpress site 6 57
zeroMAx challenge 20 105
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

825 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