473,327 Members | 2,112 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,327 software developers and data experts.

How to speed up a program that uses mouse points a lot?

I'm wondering, since my program uses a lot of mouse points when the
mouse is moving, but for resolution purposes doesn't really need to
collect so many mouse points, is it conventional to use a timer so
that mouse points are only collected every 100 or 500 ms--i.e. when
the timer fires-- rather than every 10ms (or whatever the default is
when the mouse is moving)?

It seems my program is bogging down with so many mouse points being
collected (though truth is, I have slow hardware).

Any thoughts appreciated.

RL
Nov 20 '08 #1
3 1806
"raylopez99" <ra********@yahoo.comwrote in message
news:e8**********************************@v42g2000 yqv.googlegroups.com...
I'm wondering, since my program uses a lot of mouse points when the
mouse is moving, but for resolution purposes doesn't really need to
collect so many mouse points, is it conventional to use a timer so
that mouse points are only collected every 100 or 500 ms--i.e. when
the timer fires-- rather than every 10ms (or whatever the default is
when the mouse is moving)?

It seems my program is bogging down with so many mouse points being
collected (though truth is, I have slow hardware).

Any thoughts appreciated.

RL

Are you doing somthing allong these lines and finding it slow?

List<PointPoints = new List<Point>();
void Form1_MouseMove(object sender, MouseEventArgs e)
{
Points.Add(e.Location);
}
Nov 21 '08 #2
"RayLopez99" <ra********@gmail.comwrote in message
news:13**********************************@w22g2000 yqd.googlegroups.com...
Thanks FTM.
well this confirmed that standard practice for most conventional apps
is not to put a timer to limit the number of points collected by the
mouse. So it must be the extra logic I'm doing (which is
considerable). The lag is not too bad now, but if it gets worse I
might limit the number of points collected with a timer.

RL

If the time lag gets too bad, I don't think I would resort to a timer. I
would fall back to the logic used in geographic information systems (GIS)
for thinning complex line segments. One option would be to keep ever N-th
point. Another option is to keep points "significantly different" from the
last point. That would entail looking at the deltas between the last kept
X, Y to the new X, Y. The first option is more likely quicker, while the
second is likely more visually accurate.

Mike

Nov 21 '08 #3
On Nov 21, 1:35*pm, "Family Tree Mike"
<FamilyTreeM...@ThisOldHouse.comwrote:
"RayLopez99" <raylope...@gmail.comwrote in message

news:13**********************************@w22g2000 yqd.googlegroups.com...
Thanks FTM.
well this confirmed that standard practice for most conventional apps
is not to put a timer to limit the number of points collected by the
mouse. So it must be the extra logic I'm doing (which is
considerable). *The lag is not too bad now, but if it gets worse I
might limit the number of points collected with a timer.
RL

If the time lag gets too bad, I don't think I would resort to a timer. *I
would fall back to the logic used in geographic information systems (GIS)
for thinning complex line segments. *One option would be to keep ever N-th
point. *Another option is to keep points "significantly different" fromthe
last point. *That would entail looking at the deltas between the last kept
X, Y to the new X, Y. *The first option is more likely quicker, while the
second is likely more visually accurate.

Mike
Yeah thanks. I like that first option, just do a modulus %N operation
and take every Nth point. I'll keep that in mind. The delta's idea
is good too.

RL
Nov 21 '08 #4

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

Similar topics

29
by: Bart Nessux | last post by:
Just fooling around this weekend. Wrote and timed programs in C, Perl and Python. Each Program counts to 1,000,000 and prints each number to the console as it counts. I was a bit surprised. I'm not...
22
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html ...
2
by: zheenma | last post by:
There is a program that speed up your typing and avoid spelling errors. My friends use it ,their averege is more than 100 wpm. You can download it from www.wamasoft.com. And It has a library for...
7
by: YAZ | last post by:
Hello, I have a dll which do some number crunching. Performances (execution speed) are very important in my application. I use VC6 to compile the DLL. A friend of mine told me that in Visual...
13
by: Lars Netzel | last post by:
Hi! I have a round area which I want to be able to move the mouse over and fire off events... how do I do that? I have drawn a FillPie Graphics and I feel that there has to be a way of...
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
4
by: canteyn | last post by:
Ok here is my problem. I am coding a program that uses 3 different functions, and the end result is that the program reads in (x,y) points from a file, and then outputs those points to another file,...
0
by: raylopez99 | last post by:
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.