Solved

setting MousePosition

Posted on 2003-11-11
8
602 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

735 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