Solved

Setting rect on CRichEditCtrl.

Posted on 2003-11-29
7
915 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 58
VBA "SendKeys" Syntax for Multiple Keystrokes 7 117
countEvens challenge 2 111
x-bar in Google Sheets 2 70
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 …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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