473,756 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.splitConta iner1.Invalidat e(true); rather than Invalidate(true )
for the whole form), and using an "invalidati ng 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 3033

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

Similar topics

18
2042
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 have done many various tests to compare the performance speed of applications written in C++ 6.0 V.S. the same ones in VB.Net or VC#.Net . The result were quiet the same( i am not sure if i have go the right path!). But I know C++ exe files use...
12
2385
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 graphics object of the form/pictureBox. Should It be better if make a graphics object from my pictureBox in load event handler of the form and store it as member variable of the form , make
8
12278
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 Invalidate(Rectangle)) flickers in a nasty way when repainting. This does not happen in the Solitare (PC + WinCe) Versions a well as in a Card game where I have the C++ Source. The use of an empty OnPaintBackground brings no visable results.
4
1308
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 so twelve lines have to be drawn on the screen. The first line drawn blacks out a previously drawn line. The second line drawn is from the current data. After this is repeated six times, the program queries the USB device for the next six sets of...
8
12776
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 to me please? A) protected static extern IntPtr GetWindowDC (IntPtr hWnd );
7
1612
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 PaintEventHandler(Draw_Graphics); } public void Draw_Graphics(object sender,PaintEventArgs e)
3
1547
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 reasons for that, which I won't go into. Anyway, there has always been one tiny bug that has annoyed me - the code that draws the initial graphic image into PictureBox1 will only work if wire it up to a button, it doesn't actually do anything if...
9
5066
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 passed. I'm struggling with making the delegate/invoke thing work, as I know GUI objects aren't thread-safe. I don't quite understand the concept I'm supposed to use to modify the GUI thread-safe. Below is my form and my Circle class. Currently,...
4
2444
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 event handler - making it a static display. But I don't want a static display - I want to draw dynamic data so how do I get the data to the event handler - if I need to do that. I have also done line drawings on the Form but those drawings have an...
0
9431
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10014
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9844
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3780
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.