VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

 

Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 340,078 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 4,796 people online right now. Registration is fast and FREE... Join Now!




IsCursorInArea

Checks if the Cursor is in an area

Submitted By: RodgerB
Actions:
Rating:
Views: 793

Language: VB.NET

Last Modified: December 10, 2007
Instructions: 1) Copy and paste this Function into a class.
2) Read how to call the function.

Snippet


  1. ''' <summary>
  2. ''' Checks if the Cursor is in an area.
  3. ''' </summary>
  4. ''' <param name="minX">The Minimum X Value</param>
  5. ''' <param name="minY">The Minimum Y Value</param>
  6. ''' <param name="maxX">The Maximum X Value</param>
  7. ''' <param name="maxY">The Maximum Y Value</param>
  8. ''' <returns>True if it is inside the area, False otherwise.</returns>
  9. ''' <remarks></remarks>
  10.  
  11. Public Function isCursorInArea(ByRef minX As Integer, ByRef minY As Integer, _
  12. ByRef maxX As Integer, ByRef maxY As Integer)
  13.     If Windows.Forms.Cursor.Position.X >= minX And Windows.Forms.Cursor.Position.Y >= minY _
  14.     And Windows.Forms.Cursor.Position.X <= maxX And Windows.Forms.Cursor.Position.Y <= maxY Then
  15.         Return True
  16.     End If
  17.     Return False
  18. End Function
  19.  
  20. ' Example usage:
  21. If isCursorInArea(0, 0, 50, 50) Then
  22.     MessageBox.Show("Cursor is in area")
  23. End If

Copy & Paste


Comments

There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month