Hi Experts!
I am working on drawing in C#. I have a problem in this program; when I draw a new object on mouse event and paint event the previous drawn object disappears. My code is as follows.
private void picMain_MouseDown(object sender, MouseEventArgs e)
{
MouseDownPoint = e.Location;
mouseMovePoint = e.Location;
}
private void picMain_MouseMove(object sender, MouseEventArgs e)
{
mouseMovePoint = e.Location;
}
private void picMain_Paint(object sender, PaintEventArgs e)
{
G.DrawLine(new Pen(Color.Green, 10),MouseDownPoint, mouseMovePoint);
}
Please help me to draw an unlimited number of objects without erasing the previous one.
The object in my case may be any drawing object e.g rectanlge, ellipse, line,polygon etc. is there any method to store all the drawn object in arraylist or list. if so then please guide me.