Public Class Form1 Dim mouseDownLocation As Point Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load out.Show() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Try Dim bounds As Rectangle = Screen.PrimaryScreen.Bounds Dim screenshot As New Bitmap(bounds.Width, bounds.Height) Using g As Graphics = Graphics.FromImage(screenshot) g.CopyFromScreen(bounds.Location, Point.Empty, bounds.Size) End Using PictureBox1.Image = screenshot Catch s As Exception PictureBox1.Refresh() End Try End Sub Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown If e.Button = MouseButtons.Left Then mouseDownLocation = e.Location End If End Sub Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove Try If e.Button = MouseButtons.Left Then out.Left += e.Location.X - mouseDownLocation.X out.Top += e.Location.Y - mouseDownLocation.Y End If Catch x As Exception PictureBox1.Refresh() End Try End Sub Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp If e.Button = MouseButtons.Left Then mouseDownLocation = Point.Empty End If End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)