473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
Nov 5 '08 #1
0 2984

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: HerrLucifer | last post by:
I am each day becoming more and more addicted to the new .Net framework because of its cool RAD facilities. However, performance and speed is extremely important for my application development. I...
12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
8
by: Mark Johnson | last post by:
Using: VS 2003 NET C# for Framework and Framework Compact Trying : Moving a Card (Bitmap) as in Solitare (PC + WinCe) Version on OnMouseMove Problem : The affected drawing Area by Invalidate (or...
4
by: Galen Somerville | last post by:
I have a real timing problem. This involves getting data from a USB device via an ActiveX dll and drawing trace lines on the screen via a UserControl. The USB device sends six sets of pixel info...
8
by: pigeonrandle | last post by:
Hi, Please pity me, i am on a dial-up connection for the first time in 5 years :( ! Does anyone know how the resulting Graphics objects differ ...? What i really mean is can someone explain it...
7
by: rayreeves | last post by:
If I look for guidance on this topic I find simple examples like this: public class Form2:Form { public Form2() { this.Text = "FORM2"; this.Size = new Size(450,400); this.Paint += new...
3
by: Peter Webb | last post by:
When I started my current extremely graphics intensive project, I ignored advice in this ng to use the Paint method, and used the alternate CreateGraphics approach. I thought there were some good...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
4
by: AWW | last post by:
XP VB 2005 drawing line graphics in a PictureBox - from a simple minded former FORTRAN programmer. The help examples have the graphics drawing code (lines & rectangles) in the PictureBox paint...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.