setting MousePosition

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!
windsofchangeAsked:
Who is Participating?
 
_TAD_Commented:



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
 
_TAD_Commented:


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


But I don't think this will really help you
0
 
_TAD_Commented:


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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
TonylmillerCommented:
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
 
TonylmillerCommented:
I think you can only "get" MousePosition.  Can you also "set" it?
0
 
_TAD_Commented:


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
 
TonylmillerCommented:
TAD:

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

:-)

Tony
0
 
windsofchangeAuthor Commented:
thanks!
thats what i was looking for (didnt think of looking in the Cursor props)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.