Panel 이동
*
Public Class Form1
Dim panloc As New Point(0, 0)
Dim curloc As New Point(0, 0)
Private Sub setpositins()
panloc = Panel1.Location
curloc = System.Windows.Forms.Cursor.Position
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = "1"
setpositins()
End Sub

Private Sub Panel1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
Timer1.Enabled = True
Timer1.Start()
setpositins()
End Sub

Private Sub Panel1_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
Timer1.Stop()
setpositins()
End Sub

Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Panel1.Location = panloc - curloc + System.Windows.Forms.Cursor.Position
setpositins()
End Sub
End Class



1.PNG


Label1.Text = Cursor.Position.ToString


마우스 포인터 값이 Panel 안에서만 출력이됩니다

이 게시물을

공유하기

SEARCH

MENU NAVIGATION