Solved

CRichEditCtrl Problem?

Posted on 1998-03-23
5
290 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 100 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

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

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…
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 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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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