Answer the question
In order to leave comments, you need to log in
How to fix disappearing polygon in pictureBox?
Own using this code:
curvePoints = new Point[5000];
for (int i = 1; i < 5000; i++)
{
curvePoints[i] = new Point(i, Convert.ToInt32(10000/i));
}
Graphics g = pictureBox1.CreateGraphics();
Pen blackPen = new Pen(Color.Black, 1);
g.DrawPolygon(blackPen, curvePoints);
Answer the question
In order to leave comments, you need to log in
All drawing must be done in the Paint event handler, which occurs when the control is redrawn.
You draw in the control, but when the control is redrawn, it is cleared and "forgets" everything that was drawn. For this, you need to redraw the graph in the Paint event
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question