-
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
-
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
-
By eliminater in forum VB Classic
Replies: 0
Last Post: 09-01-2005, 07:15 AM
-
By GermanD in forum VB Classic
Replies: 3
Last Post: 04-30-2005, 11:29 AM
-
By Riki Fridrich in forum Web
Replies: 4
Last Post: 03-05-2001, 11:51 PM
-
By Ranger in forum VB Classic
Replies: 2
Last Post: 12-07-2000, 01:29 PM
-
By Ranger in forum VB Classic
Replies: 0
Last Post: 12-07-2000, 01:23 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks