?
Solved

CRichEditCtrl Problem?

Posted on 1998-03-23
5
Medium Priority
?
306 Views
Last Modified: 2013-11-19
I am trying to develop application that support simple drawing shapes and allow to insert as well a text frame.
I made a doc/view application. In my document class I have a CMyList member that contains object representing various shapes: rect, circle and so on. I drew them using CDC class members. For text frame I use CRichEditCtrl.
The problem is that I can't make them work together. When  I drag some of the simple objects the text frame don't repaint itself correctly. Beside that I can't put it in my Z-order supported by my view class and can't zoom it.
0
Comment
Question by:cyrilbdt
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 300 total points
ID: 1317155
If you are going to do it with this method, you will need to make sure that when you drag one of your own objects, and when the user lets go, you will have to invalidate all of the rich edits because they have been overwritten by your drawing. However, if you create your view with the WS_CLIPCHILDREN flag, then it should be okay. You can add

  ModifyStyle(0, WS_CLIPCHILDREN);

in your view's OnInitialUpdate() or in the OnCreate() member function.

Zooming is much harder because you need to go through every single text formatting change in the rich edit control and increase the size of the font by the zooming percentage. Note that you will have to change the size of the rich edit control itself too. You have to do this manually because the rich edit control wasn't designed with zooming.
0
 
LVL 2

Author Comment

by:cyrilbdt
ID: 1317156
Thansk for answer, it works fine!
About zooming - I have idea but I don't know how to do it.
Can I draw CRichEditCtrl in memory dc and then, using StrechBlt to draw it in view?
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1317157
No, you cannot tell the control to draw to a memory dc. You'll have to use the font changing method.


0
 
LVL 2

Author Comment

by:cyrilbdt
ID: 1317158
I find better decision to the problem - CRichEditCtrl::FormatRange(). It paint control in target dc and can zoom it, just what I want. But know I have problems with finding out what "TWIPS" means, but I'll handle it.
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1317159
There are 1440 twips to an inch. Do a query (not a search) on twips in the VC++ online help.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 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