Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

setting MousePosition

Posted on 2003-11-11
8
Medium Priority
?
610 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 1500 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

719 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