Solved

setting MousePosition

Posted on 2003-11-11
8
600 Views
Last Modified: 2010-04-16
hi

in a scrollable control i want to press the right mousebutton and while moving the mouse the autoscrollposition changes. (its actually the same than dragging the scrollbars with the left mousebutton)
this works so far. but now i want the mousecursor to stay where it is and only the control to be scrolled. (its the same navigation, that map-oriented role-games use)

or:

how can i SET the MousePosition?

thanks!
0
Comment
Question by:windsofchange
  • 4
  • 3
8 Comments
 
LVL 22

Expert Comment

by:_TAD_
ID: 9722662


MousePosition.X = ##;
MousePosition.Y = ##;


But I don't think this will really help you
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 9722693


I guess what I mean is that if you are clicking and dragging a control, then I am pretty sure that the control is linked to the mouse position.  If you want to have the mose position constant then I think you may not get your desired affect.


However, you could have the mouse snap back to its original position after the move... This would allow you to move your control, and then as soon as you are done the mouse would return to the place where it started
0
 
LVL 4

Expert Comment

by:Tonylmiller
ID: 9722846
How about if you use the MouseButtons property to determine when the right button is pressed, and make the mouse pointer invisible during that time?  This way, it is moving but they would not see it so it would not be a distraction.  Then when the button is released, make it visible again.

Good luck,

Tony
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:Tonylmiller
ID: 9722863
I think you can only "get" MousePosition.  Can you also "set" it?
0
 
LVL 22

Accepted Solution

by:
_TAD_ earned 500 total points
ID: 9723018



Ack!  intellisense lied to me.  :-(



Here... run this code:


            private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
            {
                  Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
            }
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 9723034


I think what you may want to do is hide the cursor (or mouse ICON), and then let the user move it around at will... then at the end, just before you show it you put it back to it's original position.
0
 
LVL 4

Expert Comment

by:Tonylmiller
ID: 9723295
TAD:

Great idea!  I wish I'd thought of that!

:-)

Tony
0
 

Author Comment

by:windsofchange
ID: 9729815
thanks!
thats what i was looking for (didnt think of looking in the Cursor props)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
converto datetime always changes format 9 41
Where did System.Data.Objects go? 2 40
how to double quote a string for an inline sql statement. 8 73
linq, c# 8 23
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question