1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | Dim bClick As Boolean Private Sub Form1_MouseDown(ByVal sender As Object, _ ByVal e As MouseEventArgs) Handles MyBase.MouseDown bClick = True End Sub Private Sub Form1_MouseMove(ByVal sender As Object, _ ByVal e As MouseEventArgs) Handles MyBase.MouseMove Static nX As Single Static nY As Single If bClick Then If nX <> 0 Then Me.Left = Me.Left + e.X - nX Else nX = e.X End If If nY <> 0 Then Me.Top = Me.Top + e.Y - nY Else nY = e.Y End If Else nX = 0 nY = 0 End If End Sub Private Sub Form1_MouseUp(ByVal sender As Object, _ ByVal e As MouseEventArgs) Handles MyBase.MouseUp bClick = False End Sub |
Inserendo il codice soprariportato potrete muovere il vostro form in drag and drop
Nessun commento:
Posta un commento
Si prega di non commentare in modo volgare e/o offensivo.