Solved

Setting rect on CRichEditCtrl.

Posted on 2003-11-29
7
903 Views
Last Modified: 2013-11-20
I have a rich edit view.  The text runs all the way to the edges and I can't figure out how to set it in - give the control margins on the screen.  I use this...

CRect rect;
GetRichEditCtrl().GetRect(&rect);
rect.DeflateRect(15, 0);
GetRichEditCtrl().SetRect(&rect);

...in OnCreate in my Rich Edit View class and it works fine in XP.  But it doesn't in Win98.  I sat here for two hours trying every combination of getrect, getclientrect, setrect, invalidate, GetRichEditCtrl.Invalidate -- everything I can think of and I can't get the text to budge off the sides of the control.  The left side doesn't look too bad, but on the right side the text goes right up against the edge.  

Can someone please help me set the margins on a rich edit view?  Thanks.
0
Comment
Question by:jjjkkklll
  • 3
  • 3
7 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 9844563
Instead of rich edit view use CFormView with rich edit control and set rich edit rectangle in WM_SIZE message handler.
0
 

Author Comment

by:jjjkkklll
ID: 9845285
Hi AlexFM,

That would probably work, but I'm very dug in on this one - it's too late to change it all at this point.  Is there no way to change the typing area on an existing rich edit view?
0
 

Expert Comment

by:Particleness
ID: 9847164
The rich edit works on XP but not Windows 98...I had a problem when that happened and just replaced the rich edit control dll file on win98 with the xp one. If you're selling your product, though, I don't know how you can legally distribute the dll file.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Expert Comment

by:Particleness
ID: 9847324
I just researched the redistribution of rich edit controls and it happens you're out of luck: http://www.codeguru.com/mfc/comments/12047.shtml Sorry.
0
 

Expert Comment

by:Particleness
ID: 9847335
From that link you an get to a workaround with a microsoft installer, but then you bog down the user in installing MSI with your software.
0
 

Author Comment

by:jjjkkklll
ID: 9852187
Thanks Particleness for your info.  I finally used AlexFM's suggestion out of frustration.  What I did was to change my RichEditView to a FormView.  I created a new program with FormView as the view's base class and then took it file by file to change the view over.  Then I solved a pile of compiler errors one at a time.  Then I added the rich edit control and everything seems to work fine.  It actually didn't take as long as I thought it would (about 2 hours).  I'm sure there's a lot of extra code bits in there that I don't need anymore, but it's working so I'm not touching it.  Thanks for your help.
0
 

Author Comment

by:jjjkkklll
ID: 9852201
Just to clarify (after reading my last post) I compared my existing program to the new FormView program and I changed my existing program to have a formview - I didn't start from scratch, I converted my existing RichEditView to a FormView.  Just wanted to make that clear.  Thanks again.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 135
ORA-01403: no data found 43 101
FizzBuzz challenge 9 80
mapAB Challlenge 35 144
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 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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 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