I think you need to draw set of lines while you put points on a picture_Box by clicking on it. What you do with this code is, you collect the set of points as the mouse clicks, copy the set of points in to a local array, create an image with drawing lines with the local array and then set the image to the pictureBox1.
I think the best way is to do this is drawing lines with in the "Paint" event of the picture box.
change the mouse event as the follow.
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
pointArray[iNumberofClicks].X = e.X;
pointArray[iNumberofClicks].Y = e.Y;
iNumberofClicks++;
pictureBox1.Refresh();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if(iNumberofClicks >1)
{
Pen PenSpikes = new Pen(Color.Green);
Graphics g = e.Graphics;
g.DrawLines(PenSpikes, pointArray);
}
}
When ever you put a new point, you can see the new line. If you need to scale up the drawing you can simply multiply the x and y coordinates of the points in the array by the scale factor you need and then call pictureBox1.Refresh().
private void scaleDrawing(double factor)
{
for (int i = 0; i < iNumberofClicks; i++)
{
pointArray[i].X = (int)pointArray[i].X*factor;
pointArray[i].Y = (int)pointArray[i].Y*factor;
}
pictureBox1.Refresh();
}
This is how I understand your question. Please clarify if I'm wrong.