Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a text box that displays the cursor coordinates for the form mousemove event:

Textbox1.Text = (Cursor.Position.X & " " & Cursor.Position.Y)

 

The form occupies the whole screen area. The screen width is 1024 pixels but I notice that if the mouse is moved very quickly off the edge of the form then the textbox display doesn't keep up. For example the last x value displayed can be as low as 900 depending on how fast I move the mouse sideways.

Can someone explain why this should happen??

  • *Gurus*
Posted

Your system just isn't fast enough to keep up with the pointer. Moving the mouse pointer very fast always has the result that it jumps in intervals of more than one pixel, there's not much you can do about it.

 

You could capture the MouseLeave event of your form, get the mouse coordinates _then_ interpolate between them and the last set of recorded coordinates I suppose.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted
to get around this problem add a Timer to your form and enable it - set the interval to whatever you want (~300ms should be okay) and update the display of the Mouse position in the Timer's Tick-Event! this way you've always the current position of the mouse...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...