.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 12th, 2006, 11:26 AM
Tony Lintunen Tony Lintunen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 10 Tony Lintunen User rank is Private First Class (20 - 50 Reputation Level)Tony Lintunen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 25 m 19 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old January 12th, 2006, 11:44 AM
MBirchmeier's Avatar
MBirchmeier MBirchmeier is offline
I <3 ASCII
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Posts: 2,396 MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level)MBirchmeier User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 19 h 13 m 20 sec
Reputation Power: 1231
Send a message via AIM to MBirchmeier
Quote:
Originally Posted by Tony Lintunen
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

What would be the need to alter the mouse's position? Don't you think you'd be a bit miffed if someone didn't let you move your mouse where you wanted to?

Why would it need to be a mouse click event, you could just move mouse click code to another part of code, such as an onload method?

-MBirchmeier
__________________
My fiancee's transition from accountant to writer
0x4279 7465 204D 6521

Reply With Quote
  #3  
Old January 12th, 2006, 01:45 PM
Tony Lintunen Tony Lintunen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 10 Tony Lintunen User rank is Private First Class (20 - 50 Reputation Level)Tony Lintunen User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 25 m 19 sec
Reputation Power: 0
Quote:
Originally Posted by MBirchmeier
What would be the need to alter the mouse's position? Don't you think you'd be a bit miffed if someone didn't let you move your mouse where you wanted to?

Why would it need to be a mouse click event, you could just move mouse click code to another part of code, such as an onload method?

-MBirchmeier


I want a way to automatically resize a datagrid's columns to the correct width. I'm not particularly fond of the method where you iterate through all the rows and set the width according to the widest row.

I want to simulate a datagrid column click, which resizes the column appropriately. I want to do this by programmatically moving the mouse to the column's right edge, and sending a column click message to the datagrid.

Is there a .net equivalent of the win32 api sendmessage function?

Thanks,

Tony

Reply With Quote
  #4  
Old January 12th, 2006, 03:21 PM
Pajaysn Pajaysn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Location: England
Posts: 11 Pajaysn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 49 sec
Reputation Power: 0
Send a message via MSN to Pajaysn
You could always use this:

Code:
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Integer, ByVal Y As Integer) As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SetCursorPos(200, 200)
    End Sub


That will set your mouse to co-ordinates 200x200 upon clicking a command button.

Reply With Quote
  #5  
Old February 10th, 2006, 05:18 AM
Mystret Mystret is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 1 Mystret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 49 sec
Reputation Power: 0
Ah nice, thx. I needed this too
Do you also know how to click the left mouse button after you moved the mouse?
Thanks in advance

Mystret

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Changing mouse position programmatically

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap