DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    10

    Changing mouse position programmatically

    Hello everyone. I would like your assistance in learning how to do the following two things in .net:

    1. How do I alter the mouse position programmatically?

    2. How do I send an event (ie. mouse click event) to a specific control?

    Thanks a bunch,

    Tony

  2. #2
    Join Date
    Nov 2003
    Posts
    154
    To set the cursor position, assign the desired point (in screen coordinates) to the Cursor.Position property.

    Cursor.Position = New Point(300, 50)

    To fire a control event, just call it. For example, if you have a button click event for Button1 defined as:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) Handles Button1.Click
    MessageBox.Show("This is Button1's click event.")
    End Sub

    You can fire the click event from code like this:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) Handles Button2.Click
    Button1_Click(Me, Nothing)
    ' or Button1_Click(Nothing, Nothing) or any other valid values for the parameters
    End Sub
    A. Russell Jones,
    Executive Editor,
    Internet.com

Similar Threads

  1. Icon infomration from Mouse position
    By eliminater in forum VB Classic
    Replies: 0
    Last Post: 09-01-2005, 07:15 AM
  2. Mouse position
    By GermanD in forum VB Classic
    Replies: 3
    Last Post: 04-30-2005, 11:29 AM
  3. position of mouse in NN6
    By Riki Fridrich in forum Web
    Replies: 4
    Last Post: 03-05-2001, 11:51 PM
  4. Mouse Position
    By Ranger in forum VB Classic
    Replies: 2
    Last Post: 12-07-2000, 01:29 PM
  5. Mouse Position
    By Ranger in forum VB Classic
    Replies: 0
    Last Post: 12-07-2000, 01:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links