Solved

CRichEditCtrl Problem?

Posted on 1998-03-23
5
295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 95
Complete beginner needs help making a cron job 9 131
sum28 challenge 31 117
pre4 challenge 19 111
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 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