473,387 Members | 1,812 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,387 software developers and data experts.

Magnetic Cursor

I have written some custom controls that can dragged around a container
control. When the controls reach the edges of the container control,
they stop moving. The mouse continues to travel beyond the border of
the control. When the mouse direction of travel changes, the control
then moves accordingly (I tie the movement of the control to the
MousePosition delta). Is there some way to magnet the cursor to the
control, so when the control stops moving the mouse does the same?

Dec 1 '06 #1
3 1304

Charlie Brown ha scritto:
I have written some custom controls that can dragged around a container
control. When the controls reach the edges of the container control,
they stop moving. The mouse continues to travel beyond the border of
the control. When the mouse direction of travel changes, the control
then moves accordingly (I tie the movement of the control to the
MousePosition delta). Is there some way to magnet the cursor to the
control, so when the control stops moving the mouse does the same?
The most obvious way seems to keep track of the mouse position
under MouseMove and, when you need to freeze it, just:

Windows.Forms.Cursor.Position = PreviousPosition

Dec 1 '06 #2
I gave that one a shot, it just makes the mouse jump all over the
place.

to**************@uniroma1.it wrote:
Charlie Brown ha scritto:
I have written some custom controls that can dragged around a container
control. When the controls reach the edges of the container control,
they stop moving. The mouse continues to travel beyond the border of
the control. When the mouse direction of travel changes, the control
then moves accordingly (I tie the movement of the control to the
MousePosition delta). Is there some way to magnet the cursor to the
control, so when the control stops moving the mouse does the same?

The most obvious way seems to keep track of the mouse position
under MouseMove and, when you need to freeze it, just:

Windows.Forms.Cursor.Position = PreviousPosition
Dec 5 '06 #3
It depends on how you have implemented it.
I used this technique and to me it worked fine.

If you wish, post a very simplified and working sample of your
code showing the problem, I will be happy to take a look at it...

-T

Charlie Brown ha scritto:
I gave that one a shot, it just makes the mouse jump all over the
place.

to**************@uniroma1.it wrote:
Charlie Brown ha scritto:
I have written some custom controls that can dragged around a container
control. When the controls reach the edges of the container control,
they stop moving. The mouse continues to travel beyond the border of
the control. When the mouse direction of travel changes, the control
then moves accordingly (I tie the movement of the control to the
MousePosition delta). Is there some way to magnet the cursor to the
control, so when the control stops moving the mouse does the same?
The most obvious way seems to keep track of the mouse position
under MouseMove and, when you need to freeze it, just:

Windows.Forms.Cursor.Position = PreviousPosition
Dec 6 '06 #4

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

Similar topics

2
by: Lumpierbritches | last post by:
Thank you in advance for any and all assistance. It is greatly appreciated. Has anyone used Access to keep track with reader/writer magnetic encoders? I have purchased a Fargo Printer that does...
1
by: Richard Beacroft | last post by:
Does anyone know how to simulate a magnetic swipe. i.e. send key strokes (those outside the alphanumeric range)?
1
by: ryan.arasteh | last post by:
Hi, I want to write a c# application to capture the contents of a magnetic stripe card with a card reader attached to the USB or COM port of the PC. Are there any libraries or anything available...
1
by: ryan.arasteh | last post by:
Hi, I want to write a c# application to capture the contents of a magnetic stripe card with a card reader attached to the USB or COM port of the PC. Are there any libraries or anything...
5
by: RedEye | last post by:
Hello, I need to toss together a quick pocket pc app that uses a magnetic strip reader as it's primary method of input. I was wonder if there are any open source API's for this. Thanks for...
2
by: mickeymicks | last post by:
Has anyone tried to do magnetic forms in c# already? Basically i want to emulate the behaviour of Winamp, wherein the forms get magnetized to each other. I've seen this done in some components...
3
applets
by: applets | last post by:
Is there an activeX component in connecting a magnetic card reader in vb6.0 application? im currently working on a project that includes scanning magnetic card into the vb application is there a...
3
by: Charlie Brown | last post by:
I have written some custom controls that can dragged around a container control. When the controls reach the edges of the container control, they stop moving. The mouse continues to travel beyond...
2
by: perpetualsoft | last post by:
well, I want to develop a application in VB 6.0 which get value from magnetic card through MSR and save in text field. Basically I using Magnetic Slot Reader with Keyboard Interface. its a product of...
0
by: saifullah | last post by:
Magnetic Bracelets - an alternative therapy For many thousands of years Lodestone, a naturally occuring magnet, was used in healing the body. Early writings in many different countries...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.