469,631 Members | 1,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Tricks to speed up graphics: and why does Invalidate on MouseMoveaffect performance?


I'm getting into GDI+ Forms 2.0 graphics for C#3 using Visual Studio

One thing I notice: the graphics are really slow and flicker on a
Pentium IV, with 2 GB RAM, even with doublebuffering turned on.

I did learn tricks such as not invalidating everything, but just the
control that is part of the form you are working on (i.e.,
this.splitContainer1.Invalidate(true); rather than Invalidate(true)
for the whole form), and using an "invalidating rectangle" that
travels with your mouse pointer when invalidating during MouseMove.

But what about some other tricks? Such as can you make several
"layers" and invalidate some of them only, and, if so, what control
(panel?) should I be using for a "layer"?

Further, I notice that trying to do a 'breadcrumb' of mouse points
that are drawn when handling "MouseMove" event is very, very graphics

Worse, I notice it affects the performance of certain non-graphics
routines, which is really surprising. For example, I collect the e.X,
e.Y on MouseMove and feed it into an array/list. When
Invalidate(true) is present in MouseMove, the collection of e.X,e.Y is
severely slowed down, so much so that sometimes points traversed by
the mouse are missed by the non-graphics routines (!). Anybody else
notice this happen? And what to do about it? Turning off
"Invalidate" inside of MouseMove solves the problem. So the solution
is either this, or to somehow speed up Invalidate by only invalidating
part of the form. For example, I draw a series of small lines during
"MouseMove" to show a sort of "breadcrumb" trail of the mouse. But
this non-essential visual candy slows down the non-graphics methods of
my app, and since it's only supposed to be an optional aid for the
user, I got rid of it. The app speed up noticeably and did not miss
any points, unlike when Invalidate was turned on. But it would be
nice to get a suggestion as to how to speed up Invalidate so I can
reintroduce this breadcrumb feature. Perhaps draw it on a 'layer'?
What to choose as the layer, and how can I be sure it will speed up
the app--has anybody done this before?

Sorry if this is a silly question that you've seen before.

Any suggestions welcome.

Nov 5 '08 #1
0 2703

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Sanjay | last post: by
8 posts views Thread by Mark Johnson | last post: by
4 posts views Thread by Galen Somerville | last post: by
7 posts views Thread by rayreeves | last post: by
4 posts views Thread by AWW | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.