I am working on a project where I let the users to draw some shapes and save the whole drawing panel(c# window form) ,so that they can open the panel later to edit their drawing.
I am thinking of saving all other things(such as name and type of the drawing,) in a json file But do not know how to save the drawn shapes and more importanly how to display them again.
[]
the white panel is for drawing.( part i want to save)
New Village- to clear all the drawing
Save village- to save all the shapes drawn on the white part
Open village-to open a previously stored state of drawn shapes.
Drawing method
g= drawing_panel.CreateGraphics();
village_name.Text = "Okay";
pr.setName(village_name,drawing_panel);
Pen p = new Pen(Color.Black);
g.DrawEllipse(p, 10, 10, 100, 100);
g.DrawLine(p, 150, 150, 300, 300);
Serializing method
BlogSites bsObj = new BlogSites()
{
Name = "C-sharpcorner",
Description = "Share Knowledge"
};
// Convert BlogSites object to JOSN string format
string jsonData = JsonConvert.SerializeObject(bsObj);