Folks,

I need to make a fairly simple WinForms custom control. It will have about hundred or so graphics shapes (lines, circles). Little to no animation. At the moment of writing, I don't expect it to be very graphics intensive. At the same time, I don't have experience with drawing custom controls.

I've following this tutorial: Creating a professional looking GDI+ drawn custom control. I've noticed that some brushes in this tutorial are member variables (fields) of the control, and those are initialized once. Other brushes and pens are newed-up every time OnPaint() is called and disposed.

Is it okay to new-up pens and brushes in OnPaint() every time it's called? Does that make sense?

Any suggestion, insight or reference is really appreciated!

Cheers,
- Nick