Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form3.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form3.Show()
Button1.Visible = False
End Sub
Dim walls As New ArrayList
Dim drag As Boolean = False
Dim i As Integer = -1
Dim i2 As Integer
Private Sub Label1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.TextChanged
If Label1.Text = "pic1" Then
Dim wall As New PictureBox
wall.Location = MousePosition
wall.BackColor = Color.Silver
wall.Size = New Point(104, 16)
If Form3.OpenFileDialog2.FileName = Nothing Then
If Form3.ColorDialog2.Color = Nothing Then GoTo a
wall.BackColor = Form3.ColorDialog2.Color
a:
Else
Dim img As Image = Image.FromFile(Form3.OpenFileDialog2.FileName)
wall.Image = img
End If
walls.Add(wall)
For Each PictureBox In walls
q1 = q1 + 1
i = q1
Next
drag = True
wall.Tag = i.ToString
Me.Controls.Add(wall)
AddHandler wall.MouseDown, AddressOf wall_mousedown
End If
End Sub
Dim q1 As Integer = -1
Private Sub wall_mousedown(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim wall As PictureBox = CType(sender, PictureBox)
AddHandler wall.MouseMove, AddressOf wall_mousemove
If drag = True Then
drag = False
Label1.Text = ""
Else
drag = True
End If
End Sub
Private Sub wall_mousemove(ByVal sender As Object, ByVal e As MouseEventArgs)
If drag = True Then
Dim wall As PictureBox = CType(sender, PictureBox)
wall.Location = New Point(MousePosition.X - 20, MousePosition.Y - 10)
End If
End Sub
End Class