Hi,
I'm getting into GDI+ Forms 2.0 graphics for C#3 using Visual Studio
2008.
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
intensive.
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.
RL