View Single Post
Old 13-01-2010, 13:32   #2
MarcoGG
Senior Member
 
L'Avatar di MarcoGG
 
Iscritto dal: Dec 2004
Messaggi: 3210
Semplice. Posto che sia "Label1" la Label interessata :

Codice:
Public Class Form1

    Private selezione As Boolean = False
    Private lblPosX As Integer = 0
    Private lblPosY As Integer = 0

    Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
        selezione = True
        lblPosX = e.X
        lblPosY = e.Y
    End Sub

    Private Sub Label1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove
        If selezione = True Then
            Me.Left += e.X - lblPosX
            Me.Top += e.Y - lblPosY
        End If
    End Sub

    Private Sub Label1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp
        selezione = False
    End Sub

End Class
MarcoGG è offline   Rispondi citando il messaggio o parte di esso