Hi,
I have been looking for ages on google but with no luck. What I am doing is trying to add a screen capture facility to my app. I have written the code to capture a region on my computer depending on xy values that I have entered just to test the code, and this works. But what I want to be able to do is the user to click a button and then select one point and then a second point on the screen and to get the cursor positions when the mouse is clicked in both locations.
What I am having the problem doing is stopping my script from recording the cursor positions when the user clicks the button. In other words I want the user to click the button to create a screen capture then need the app to wait for 2 mouse clicks before proceeding through the rest of the code.
Thanks
Simon
I have been looking for ages on google but with no luck. What I am doing is trying to add a screen capture facility to my app. I have written the code to capture a region on my computer depending on xy values that I have entered just to test the code, and this works. But what I want to be able to do is the user to click a button and then select one point and then a second point on the screen and to get the cursor positions when the mouse is clicked in both locations.
What I am having the problem doing is stopping my script from recording the cursor positions when the user clicks the button. In other words I want the user to click the button to create a screen capture then need the app to wait for 2 mouse clicks before proceeding through the rest of the code.
Visual Basic:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SC As New ScreenShot.ScreenCapture
Dim x1 As Integer
Dim y1 As Integer
Dim x2 As Integer
Dim y2 As Integer
' Need some code here to wait for a mouse click before doing code below
x1 = Cursor.Current.Position.X
y1 = Cursor.Current.Position.Y
' Need some code here to wait for second mouse click before doing code below
x2 = Cursor.Current.Position.X
y2 = Cursor.Current.Position.Y
'At the moment I have just entered in positions to test
Dim MyBitMap As Bitmap = SC.CaptureDeskTopRectangle(New Rectangle(0, 0, _
300, 300), 300, 300)
MyBitMap.Save("c:\desktopregion.jpg", Imaging.ImageFormat.Jpeg)
End Sub
Thanks
Simon