I created a Picturebox array for adding pictures at run time.I also added a mousemove event for it.but now the problem is when i move a picbox1 after creating picbox2 ,picbox2 simply dissappears.Same goes on while adding picboxes,the just previous ones get dissappeared.This is event handler code i wrote
Code:
Private Sub PictureBox1_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim sX As Integer = RectangleToClient(New Rectangle(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y, 1, 1)).Left - oControlOffsetPoint.X
Dim sY As Integer = RectangleToClient(New Rectangle(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y, 1, 1)).Top - oControlOffsetPoint.Y
For i As Integer = 0 To x
If e.Button = Windows.Forms.MouseButtons.Left Then
sender.Location = New Point(sX, sY)
PicBoxArray(x).Left = sX
PicBoxArray(x).Top = sY
End If
Next
End Sub