Private Sub Form_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim xOffset As Integer
Dim yOffset As Integer
If e.Button = MouseButtons.Left Then
xOffset = -e.X - SystemInformation.FixedFrameBorderSize.Width
yOffset = -e.Y - SystemInformation.FixedFrameBorderSize.Height
mouseOffset = New Point(xOffset, yOffset)
isMouseDown = True
End If
End Sub
Private Sub Form_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If isMouseDown Then
Dim mousePos As Point = Control.MousePosition
mousePos.Offset(mouseOffset.X, mouseOffset.Y)
Location = mousePos
End If
End Sub
Private Sub Form_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Left Then
isMouseDown = False
End If
End Sub
허당 레몬도리
@LemonDory
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!