[Vb.net] Picturebox verplaatsen

Pagina: 1
Acties:

  • PreDaTorY
  • Registratie: November 2000
  • Laatst online: 30-03 12:25
Mensen,

Ik ben bezig met een programmatje in VB.NET en nu loop ik tegen een klein probleem aan, ik kan inmiddels met drag drop een plaatje in 'het veld' spelen daarvoor maak ik een picturebox aan en geef deze picture een handler mee

hier ff wat code
Visual Basic:
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
32
Private Sub Speler_MouseDown(ByVal sender As Object, ByVal e As _ MouseEventArgs)
        If e.Button = MouseButtons.Left Then
            Dim pic As PictureBox = CType(sender, PictureBox)
            If Not pic.Image Is Nothing Then
                pic.DoDragDrop(pic.Image, DragDropEffects.Move)
            End If
        End If
End Sub

    Private Sub FclsVeld_DragDrop(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
        If e.Data.GetDataPresent(DataFormats.Text) Then
            Dim _imageindex As String = e.Data.GetData(DataFormats.Text)
            Dim pic As New PictureBox()

            pic.Image = Me.ImageList1.Images(_imageindex)
            pic.Location = Me.PointToClient(Me.MousePosition)
            pic.Size = New Size(88, 155)
            pic.Name = "Speler" & _count
            pic.BackColor = System.Drawing.Color.Transparent
            pic.Text = pic.name

            AddHandler pic.MouseDown, AddressOf Speler_MouseDown
            Controls.Add(pic)
            _count = _count + 1
        ElseIf e.Data.GetDataPresent(DataFormats.Bitmap) Then
            Dim pic As PictureBox = CType(sender, PictureBox)
            pic.image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
        Else
            MsgBox("dat gaat dan niet goed!")
        End If
    End Sub


Speler_mousedown word wel aangeroepen.. maar het plaatje word niet verplaatst... what's wrong?

[ Voor 5% gewijzigd door PreDaTorY op 16-04-2003 11:06 ]


  • PreDaTorY
  • Registratie: November 2000
  • Laatst online: 30-03 12:25
niemand enig idee hoe je dus gewoon een in het programma aangemaakt object kan verplaatsen?