728x90
반응형
【 VB.NET 】
# 버튼 드래그 이동 하기 ( Dragmove )
@ Form.vb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Public Class Form1 Dim X, Y As Integer Dim skin As New System.Drawing.Point Private Sub Button1_MouseDown(sender As Object, e As MouseEventArgs) Handles Button1.MouseDown X = Control.MousePosition.X - Button1.Location.X Y = Control.MousePosition.Y - Button1.Location.Y End Sub Private Sub Button1_MouseMove(sender As Object, e As MouseEventArgs) Handles Button1.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then skin = Control.MousePosition skin.X -= (X) skin.Y -= (Y) Button1.Location = skin End If End Sub End Class | cs |
@ Memo
1. 마우스 다운에서 포인트 좌표 입력
2. MOVE 에서 현위치와의 좌표 차이 비교 합산
728x90
반응형
'Programing (프로그래밍) > VB.NET' 카테고리의 다른 글
VB.NET - TextBox 가장 끝자리로 포커스 이동하기 ( TextBox / Focus / Cursor ) (0) | 2021.09.16 |
---|---|
VB.NET - 키보드 이벤트를 버튼 클릭 이벤트로 넘기기 ( KeyPreview / KeyDown / Form ) (0) | 2021.09.16 |
VB.NET - 각종 정보 출력하기 (0) | 2017.10.17 |