Public Class Form1 Dim oloc As New Point(0, 0) Dim ocur As New Point(System.Windows.Forms.Cursor.Position) Dim CurPos, AppSize As New Point(0, 0) Private Sub Sync() CurPos = Cursor.Position AppSize = Me.Size End Sub Private Sub refpositions() oloc = Me.Location ocur = System.Windows.Forms.Cursor.Position End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.WindowState = FormWindowState.Minimized End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If Me.WindowState = FormWindowState.Maximized Then Me.WindowState = FormWindowState.Normal Button2.Text = "Maximize" Else Me.WindowState = FormWindowState.Maximized Button2.Text = "Restore" End If End Sub Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown RszTmr.Start() refpositions() End Sub Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp RszTmr.Stop() refpositions() End Sub Private Sub RszTmr_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles RszTmr.Tick Me.Location = oloc - ocur + System.Windows.Forms.Cursor.Position refpositions() End Sub Private Sub Panel2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel2.MouseDown MoveTmr.Start() Sync() End Sub Private Sub Panel2_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel2.MouseUp MoveTmr.Stop() Sync() End Sub Private Sub MoveTmr_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MoveTmr.Tick Me.Size = AppSize - CurPos + Cursor.Position refpositions() End Sub End Class