Solved

Setting rect on CRichEditCtrl.

Posted on 2003-11-29
7
892 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
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.

 

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

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

Suggested Solutions

Title # Comments Views Activity
VBA "SendKeys" Syntax for Multiple Keystrokes 7 103
bigDiff challenge 17 84
wordcount challenge 11 110
how to use laptop or pad camera in vb.net windows application 2 55
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

861 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

21 Experts available now in Live!

Get 1:1 Help Now