Solved

setting MousePosition

Posted on 2003-11-11
8
574 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
 
LVL 4

Expert Comment

by:Tonylmiller
ID: 9722863
I think you can only "get" MousePosition.  Can you also "set" it?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now