I need call PaintEvent in while(canDrawing)
loop. Where I need use loop?
In Event it can't stop drawing, Esc
doesn't call.
public Form1()
{
InitializeComponent();
penCircle = new Pen(BackColor, radius);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillRectangle(brushPoint, RandomXPosition(), RandomYPosition(), 1, 1);
e.Graphics.DrawEllipse(penCircle, xPositionCircle, yPositionCircle, radius, radius);
}
private void Esc(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
canDrawing = false;
}
}