Hallo Commi.
Ich habe eine PictureBox die ich mit der Maus
verschieben kann, bloß nun will ich das ich noch eine
PictureBox hinzufügen kann per Button das ich die DAnn auch verschieben
kann und das sich die PicutreBoxen sich automatisch sich
unter einander auflisten, so das man den überblick behält!
Den code habe ich jetzt:
Danke für eure Hilfe
Ich habe eine PictureBox die ich mit der Maus
verschieben kann, bloß nun will ich das ich noch eine
PictureBox hinzufügen kann per Button das ich die DAnn auch verschieben
kann und das sich die PicutreBoxen sich automatisch sich
unter einander auflisten, so das man den überblick behält!
Den code habe ich jetzt:
VB.NET-Quellcode
- Public Class Form1
- Dim nStartPos As Point
- Dim nDragPos As Point
- Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As _
- System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
- If e.Button = Windows.Forms.MouseButtons.Left Then
- nStartPos = PictureBox1.Location
- nDragPos = PictureBox1.PointToScreen(New Point(e.X, e.Y))
- End If
- End Sub
- Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As _
- System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
- If e.Button = Windows.Forms.MouseButtons.Left Then
- Dim nCurPos As Point = PictureBox1.PointToScreen(New Point(e.X, e.Y))
- PictureBox1.Location = New Point(nStartPos.X + nCurPos.X - nDragPos.X, _
- nStartPos.Y + nCurPos.Y - nDragPos.Y)
- End If
- End Sub
- End Class
Danke für eure Hilfe