Class Window1 Private flg As Boolean = False Private x As Integer Private y As Integer Private Sub Window1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseEventArgs) Handles MyBase.MouseMove If flg Then Dim xx As Integer = Me.PointToScreen(e.GetPosition(Me)).X Dim yy As Integer = Me.PointToScreen(e.GetPosition(Me)).Y Me.Left += xx - x Me.Top += yy - y x = xx y = yy End If End Sub Private Sub Window1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles MyBase.MouseDown If e.LeftButton Then Me.CaptureMouse() flg = True x = Me.PointToScreen(e.GetPosition(Me)).X y = Me.PointToScreen(e.GetPosition(Me)).Y End If End Sub Private Sub Window1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles Me.MouseUp flg = False Me.ReleaseMouseCapture() End Sub End Class