Click to See Complete Forum and Search --> : save any drawing eg. rectangle(using GDI+) on form to b


neeta0324
July 30th, 2005, 12:17 AM
i have to make a paint program using GDI+ . I am making my shapes eg. rectangle, line directly on the form. But I have to save my work and be able to display the image again.

I don't know how to save those drawing (on the form) in a file and be able to display it again?

Hacker2
July 30th, 2005, 01:31 AM
You have to decide how to save the image to a file.
Then save that information.
Suppose you are saving a rectangle.
You need to save the rectangle location and size.
Also save the color of the rectangle, and any other details you want.
But it is up to you to decide how to save graphical shapes to a file.
Check the "Scribble" example in Microsoft.
It is a drawing program example with full source code
that may be exactly what you need.

andytim
August 17th, 2005, 12:24 AM
The simple and easy way to save the shapes on the canvas is to use MFC class CArchive,you need serialize all the data within the canvas,and override the method Serialize(CArchive& ar) of each shape.
Jack

---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library (Source Code Kit) -- http://www.********.net