-
October 21st, 2014, 02:12 PM
#1
Does it make sense top new-up pens and brushes in OnPaint() every time it's called?
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
-
October 22nd, 2014, 01:47 AM
#2
Re: Does it make sense top new-up pens and brushes in OnPaint() every time it's calle
Change some of the fields to different properties, and I'd bet it doesn't run the same. Who calls what, and with what scope, is in effect!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|