Should I create new Pens/Brushes per Paint request or keep them throughout the application lifecycle?

后端 未结 5 2162
北海茫月
北海茫月 2021-02-19 02:33

I have an application that does a lot of drawing, let\'s pretend it\'s a Viso-like application. It has objects that have multiple sub-objects that are drawn, things can

5条回答
  •  太阳男子
    2021-02-19 03:22

    Yeah best to test like @fantius suggests, you'll probably find it doesn't really matter - although I'd be temped to keep them open as if I recall correctly they're unmanaged resources and could use up your memory. If you were recreating them every time, you'd need to be especially careful of disposing them properly to avoid memory leaks.

提交回复
热议问题