Imports System.Threading
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim trd As thread = New thread(AddressOf getx) trd.isbackground = True trd.start() End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load CheckForIllegalCrossThreadCalls = False End Sub
Private Function getx() Dim i As Integer = 3 Do Until i <= 0 Label2.Text = "Position mouse over the top, left corner of the image... {" & i & " Seconds}" thread.sleep(1000) i -= 1 Loop Dim x1 As Integer = MousePosition.X Dim y1 As Integer = MousePosition.Y i = 3 Do Until i <= 0 Label2.Text = "Position mouse over the bottom, right corner of the image... {" & i & " Seconds}" thread.sleep(1000) i -= 1 Loop End Function
Dim x2 As Integer = MousePosition.X Dim y2 As Integer = MousePosition.Y Dim x3 As Integer = x2 - x1 Dim y3 As Integer = y2 - y1 MsgBox("On-screen dimensions of the image are: " & x3 & "x" & y3)
Imports System.Threading Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim trd As thread = New thread(AddressOf getx) trd.isbackground = True trd.start() End Sub Private Function getx() Dim i As Integer = 3 Do Until i <= 0 Label2.Text = "Position mouse over the top, left corner of the image... {" & i & " Seconds}" thread.sleep(1000) i -= 1 Loop Dim x1 As Integer = MousePosition.X Dim y1 As Integer = MousePosition.Y i = 3 Do Until i <= 0 Label2.Text = "Position mouse over the bottom, right corner of the image... {" & i & " Seconds}" thread.sleep(1000) i -= 1 Loop Dim x2 As Integer = MousePosition.X Dim y2 As Integer = MousePosition.Y Dim x3 As Integer = x2 - x1 Dim y3 As Integer = y2 - y1 MsgBox("On-screen dimensions of the image are: " & x3 & "x" & y3) End Function Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load CheckForIllegalCrossThreadCalls = False End Sub End Class
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.