I do not know if there is a limit in the form, the picture boxes are not in the position I set and I cannot select 595 Lines or above with the mouse in the list box. Please watch the video for details. Video = https://youtu.be/rEyuVu66G8Q
For i As Integer = 1 To FOTOLAR.Items.Count
Dim a As Integer
Dim newPictureBox As New PictureBox()
newPictureBox.Name = "PictureBox" & i
newPictureBox.Location = New Point(1, 4 + a)
ListBox2.Items.Add(4 + a)
newPictureBox.Size = New Size(55, 55)
newPictureBox.BorderStyle = BorderStyle.FixedSingle
newPictureBox.SizeMode = PictureBoxSizeMode.CenterImage
newPictureBox.BackColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))
Me.Controls.Add(newPictureBox)
a = a + 55
Dim stra As String = FOTOLAR.Items.Item(i - 1)
Dim fs As System.IO.FileStream
fs = New System.IO.FileStream(stra, IO.FileMode.Open, IO.FileAccess.Read)
newPictureBox.Image = System.Drawing.Image.FromStream(fs)
fs.Close()
AddHandler newPictureBox.MouseDoubleClick, AddressOf picd_Click
AddHandler newPictureBox.MouseClick, AddressOf pic_Click
AddHandler newPictureBox.MouseDown, AddressOf picmd_Click
AddHandler newPictureBox.MouseMove, AddressOf picmm_Click
Next
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
' Button6.Location = New Point(1, 33609)
For Each Pbox As PictureBox In Me.Controls.OfType(Of PictureBox)()
If Pbox.Name = "PictureBox612" Then
ISIMLER.SelectedIndex = 612
Pbox.BringToFront()
MsgBox("wrong: " & Pbox.Location.Y) '32767
MsgBox("Correct: 33609")
If Pbox.Location.Y = 32767 Then
Pbox.Location = New Point(1, 33609)
End If
End If
Next
End Sub