Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Drawing in a View window problem

Posted on 2004-05-01
6
Medium Priority
?
178 Views
Last Modified: 2013-11-20
Hello,

I want to draw in the View window of a MFC application. This can be done with LineTo, MoveTo, etc. Now when I want to draw a rect, that moves when my mouse moves, the old rects are still there. I can update de view window with pDoc->UpdateAllViews()  but this causes my application to crasch sometimes and the View window flickers with this 'animation'.

Is there another appraoch how  you can avoid this problem?

Herman
0
Comment
Question by:Hermy
[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
6 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 100 total points
ID: 10970261
In OnMouseMove change rectangle coordinates (keep them in member variables) and invalidate window. But don't draw in OnMouseMove, all drawing code should be in OnDraw. To prevent flickering, use memory device context.
Check out MFC sample DRAWCLI.
0
 
LVL 31

Assisted Solution

by:Zoppo
Zoppo earned 100 total points
ID: 10971528
Hi Hermy,


maybe you should even check out the CRectTracker class ... it's especailly made for implementing selection rectangles
and can be moved and resized ... in MSDN it's usage is well described.


ZOPPO
0
 
LVL 7

Expert Comment

by:vijay_visana
ID: 10974851
first you store coordinates of rectangle drawn last time.
draw the rectangle with this coordinates but with background color and then draw
new rectangle with your forground color and save coordinates
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

609 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