- Код: Выделить всё
'Перетаскивание
Private Sub PictureBox_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If Control.MouseButtons = Windows.Forms.MouseButtons.Left Then
CType(sender, PictureBox).Left = Control.MousePosition.X - Me.Left - CType(sender, PictureBox).Width
CType(sender, PictureBox).Top = Control.MousePosition.Y - Me.Top - CType(sender, PictureBox).Height
End If
End Sub
'Объекты
Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
AddHandler (PictureBox1.MouseMove), AddressOf PictureBox_MouseMove
Me.Controls.Add(PictureBox1)
End Sub