IsCursorInArea
This function returns a boolean value according to whether the cursor is in an area or not.
VB.NET
''' <summary>
''' Checks if the Cursor is in an area.
''' </summary>
''' <param name="minX">The Minimum X Value</param>
''' <param name="minY">The Minimum Y Value</param>
''' <param name="maxX">The Maximum X Value</param>
''' <param name="maxY">The Maximum Y Value</param>
''' <returns>True if it is inside the area, False otherwise.</returns>
''' <remarks></remarks>
Public Function isCursorInArea(ByRef minX As Integer, ByRef minY As Integer, _
ByRef maxX As Integer, ByRef maxY As Integer)
If Windows.Forms.Cursor.Position.X >= minX And Windows.Forms.Cursor.Position.Y >= minY _
And Windows.Forms.Cursor.Position.X <= maxX And Windows.Forms.Cursor.Position.Y <= maxY Then
Return True
End If
Return False
End Function
' Example usage:
If isCursorInArea(0, 0, 50, 50) Then
MessageBox.Show("Cursor is in area")
End If
See Also
- </DIC> Submisson - http://www.dreamincode.net/code/snippet1519.htm
page_revision: 0, last_edited: 1197781567|%e %b %Y, %H:%M %Z (%O ago)





