Solved

CRichEditCtrl Problem?

Posted on 1998-03-23
5
289 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
There are 1440 twips to an inch. Do a query (not a search) on twips in the VC++ online help.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

14 Experts available now in Live!

Get 1:1 Help Now