Sabeis el tipico arkanoid, bueno pues me lo han mandado como practica. En un form tengo dos picturebox, uno donde estan los tochos a arrastrar(son 3 cochos, cada uno mas duro k el otro y los puedo arrastrar varias veces) y el otro PB que contendran los tochos arrastrados y donde empezare la partida.
He probado muxos codigos pero no me acabo de salir para hacer el drag and drop. Me esta resultando muy dificl.
Código:
no se como seguir. necesito ayudita.Private btnDown As Integer Private offsetX As Integer Private offsetY As Integer Private llista As List(Of PictureBox) Private Sub rect3_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles rect3.MouseDown, rect2.MouseDown, rect1.MouseDown 'el boton izquierdo esta pulsado If (e.Button = MouseButtons.Left) Then btnDown = True offsetX = e.X offsetY = e.Y End If End Sub Private Sub rect3_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles rect3.MouseMove, rect2.MouseMove, rect1.MouseMove If (btnDown) Then 'mover el pictureBox con el raton Dim pb As PictureBox = New PictureBox() pb.Image = CType(sender, PictureBox).Image pb.Left += e.X + PPantalla.Location.X pb.Top += e.Y + PPantalla.Location.Y 'pb.Location = New Point(e.X + PPantalla.Location.X - offsetX, e.Y + PPantalla.Location.Y - offsetY) 'PPantalla.Controls.Add(pb) End If End Sub Private Sub rect3_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles rect3.MouseUp, rect2.MouseUp, rect1.MouseUp 'el boton izquierdo se libera If (e.Button = MouseButtons.Left) Then btnDown = False Dim pb As PictureBox = New PictureBox() pb.Image = CType(sender, PictureBox).Image pb.Location = New Point(e.X - PPantalla.Location.X + offsetX, e.Y - PPantalla.Location.Y + offsetY) PPantalla.Controls.Add(pb) End If End Sub
Gracias,, saludos