On Sat, 18 Oct 2008 15:36:06 -0700, <te***@cfl.rr.comwrote:
I'm wanting to add 320,000 controls(Panels) to an instantiated Panel
object. Yes, you heard me right, 320,000. It's for displaying a
320,000 int buffer memory status. Long story. Anyway, the controls
Add() method is way to slow for this. AddRange() isn't any better.
Probably adding that many little Panels to the controls array for the
main Panel is problematic. Anybody got any better ideas?
Yes. Don't do that.
One Control instance per buffer element is a wholely inappropriate use of
the Control class.
If you can arrange things so that you only ever are displaying some very
small number of buffer elements at a time (a few dozen at most is probably
reasonable), then you can essentially virtualize the display, updating the
visible controls as appropriate for whatever buffer elements you want to
present to the user at any given moment.
If that's not feasible, then you should write a custom control that
displays the buffer element status directly in a single control.
Hundreds of thousands of controls are a bad idea, even when spread across
multiple windows. Hundreds of thousands of controls in a single window is
just ridiculous.
Pete