Click here to Skip to main content
15,909,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually I have done few drawing in the view and now i want to collect everything in view in to an object so that i can write it on the disk by serialize method ?
Posted
Comments
Resmi Anna 7-Jun-11 23:32pm    
Is your drawing a freehand drawing like MS paint???

Or you have written all codes to draw in view like pDC->MoveTo(3,3);

pDC->LineTo(50,50);
Your requiremnet is not that clear.
you said you need to serialize a view object.
if you serialize your view object it doesn't mean that when you deserilaize it you get all your drawings back.Is that what you are trying to do?
iampradeepsharma 8-Jun-11 1:15am    
it is a free hand drawing , so far i can draw ellipse and rectangle by mouse drag .

1 solution

Dear Pradeep,

The way you are thinking is not a good approach. The correct way is to define the variable in your CDocument Class which will holds a properties of your graphical object and Override the CObject::Serialize member function in your document class to serialize all the variable. And use this initialized variable to draw the object in CView::OnDraw().

eg. To draw a rectangle you will need CRect variable in CDocument and in CView::OnDraw() use this variable to draw the Rectangle. In CDocument::Serialize() use CRect variable to store the rectangle.
 
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