400 usercontrols to display take too much time - any solution?

P

Picander

hello,

I am developing a boardgame, with a large number of customed
usercontrols ( e.g. 20 X 20 = 400 ).
I find it very usefull to use usercontrols, as they can contains
specific properties and methods, but it makes the application very
slow to redraw, even if I redraw only a small subset of them.

Is there a way to speed up the drawing time? I included in my codes
those lines:

this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);

but it does not really help.

Is there a way to remove all unused standard methods of the
usercontrol? Any suggestions?

thx,

picander
 
B

Bob Grommes

The presence of a lot of methods won't have an appreciable impact on
performance -- in fact, as far as I know, no impact other than large code
size taking memory away from other things, but remember, unlike with
instance data, there is just one copy of the code in memory per class, not
per instance. And if you don't call a given method, it's never JITted, so
there shouldn't be any overhead there.

Are you certain that drawing time is the bottleneck? There could be a lot
of other sources of the problem. If you haven't already, do some profiling
to see what is really soaking up the time. And be sure to profile and
benchmark in a non-debug version.

--Bob
 
F

Frank Hileman

If you create custom graphical objects, that know how to draw and hit test,
they will be much faster than controls. This way you use only a single
control.

Regards,
Frank Hileman

check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top