
Above is an image for a custom control that I’m working on. It’s actually three separate controls in a windows form. It’s a container control which holds multiple instances of a “Platform/console” control. The “Platform” control holds multiple instances of a “Game” control. The consoles are collapsible which will hide the games in the list.
Now the problem I’m having is the fact that when a person has say 3000 game titles, the memory usage is up around 500MB, and the control is very sluggish. Now I haven’t optimized the creation out of the application thread yet, but even after creation it’s a pig.
How would a person go about freeing resources on controls that have moved off screen? Is there a quicker way than testing each control to see if it’s in some visible area? Is there a different way I should be designing this control?
I don’t have extensive knowledge in C# so any advice would be greatly appreciated.
If you make your Control “Virtualized” you might reduce the memory footprint. Have a look at ListView, if you set ownerDrawn = true and VirtualMode =true and VirtualListSize =3000 the following code will create items (and store them) and do custom drawing.
You might be in for some extra programming because on your owner drawn control nothing comes for free…