Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
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
Comments
Alain Rist 30-Nov-10 14:18pm    
Repost of http://www.codeproject.com/Questions/131883/A-Paint-Program-in-MFC.aspx

Look at the scribble sample project provided by microsoft.
 
Share this answer
 
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
 
Share this answer
 
Store the points in a structure then using the points draw the shapes in OnPaint.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900