I'm not sure of how the Paint form lifecycle works, when is the Form1_Paint
function called? How can I control when it's called?
I know I can call Draw a Circle using the C# Drawing library like so:
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillEllipse(Brushes.Red, new Rectangle(1, 1, 1, 1));
}
If I define an object like so:
class myCircleObject
{
int x, y, radius;
public myCircleObject(int x_val, int y_val, int r)
{
x = x_val;
y = y_val;
radius = r;
}
public void Draw()
{
System.Drawing.Rectangle r = new System.Drawing.Rectangle(x, y, radius, radius);
//Draw Circle here
}
}
or if I can't do that how can I call the Form1_Paint
function as opposed to it just running immediately at run time.