Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC6 MFC GDI
Hi,
I am developing a Ms Paint like application in MFC ,but I am having problem like i am not able to retain the drawn shape,as the window is getting repainted after invalidate is getting called,
Please help me as I am kind a beginner in MFC .
Posted 30-Nov-10 6:55am
Comments
Alain Rist at 30-Nov-10 14:18pm
   
Repost of http://www.codeproject.com/Questions/131883/A-Paint-Program-in-MFC.aspx
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Look at the scribble sample project provided by microsoft.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Of course, it happens. You must record actions and re-draw on WM_PAINT (OnPaint in MFC)
 
If the painting actions are complex & cannot be recorded (like hand drawn shapes instead of lines, rectangles etc) You may draw into an offscreen memory DC (CDC::CreateCompatibleDC in MFC - imagine that as a bitmap) and draw it there. Later you can draw from that DC to screen using CDC->BitBlt on OnPaint
 
I'm not an MFC wizard, i'm used to the API. I suggest you go thru the msdn for more info on the classes
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Store the points in a structure then using the points draw the shapes in OnPaint.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 29 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100