How can I get Mouse Position?

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2009
Posts: 2
Reputation: WarMacre is an unknown quantity at this point 
Solved Threads: 0
WarMacre WarMacre is offline Offline
Newbie Poster

Re: How can I get Mouse Position?

 
0
  #11
Feb 21st, 2009
Better still, use:

  1. dim mouseLoc as point = myControl.pointToClient(myControl.Cursor)

This gets the location relative to the container Form, not the screen.

Function:

  1. Private Function getMouseLoc() As Point
  2. getMouseLoc = Me.PointToClient(Me.Cursor.Position)
  3. Return getMouseLoc
  4. End Function
  5.  
  6. dim mouseLoc as point = getMouseLoc()

Or

  1. Dim mouseLocX as integer = getMouseLoc.X
  2.  
  3. Dim mouseLocY as integer = getMouseLoc.Y
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: DOT208 is an unknown quantity at this point 
Solved Threads: 0
DOT208 DOT208 is offline Offline
Newbie Poster

RE: 2010 version

 
0
  #12
Oct 22nd, 2009
Originally Posted by Mr.Stupid View Post
  1. Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
  2.  
  3. Label1.Text = "X." & e.X & vbCrLf & "Y." & e.Y
  4.  
  5. End Sub
So I' a re-beginner familiar with older BASIC stuff but not a VISUAL expert. If the MouseMove stuff is gone from the 2010 version toolbox or whatever, how do you do it now? Thanks.
Last edited by DOT208; Oct 22nd, 2009 at 8:24 pm.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC