I'm drawing all my stuff on a form. So I don't need any controls at all.
Currently I have an Form1_Paint
method and drawing all inside this event method.
private void Form1_Paint(object sender, PaintEventArgs e)
{
// draw something
}
I could also override the OnPaint
method.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e); // works also without this
//draw something
}
Which of these approachs is better / should I use?
The difference it's almost nothing. The main difference is if you create another form for the same type, the another form will Paint like the first one. For OnPaint() method it not a huge difference, but for another functions, like click, etc, it is noticiable that you would need a Paint event.
A clear example of this is a Button, or another control. Every Button has its function. If you have a OnMouseClick() method all Buttons will do same actions, but with the Paint event you can customize every Button actions. OnPaint() method it's good for stardands and to avoid events.