Bonjour à tous,

je génère un quadrillage de PictureBox dans une boucle en cliquant sur un bouton

Malheureusement je ne peu accéder aux propriétés de ces Picturebox n’existant qu'au lancement du programme

que dois-je faire pour accéder à leurs propriétés?

Ci-joint le code de création des ces PictureBox

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
 
        Dim posx As Integer = 0
        Dim posy As Integer = 0
        Dim Cx As Integer = 1
        Dim Cy As Integer = 0
 
        Tx = Val(TextBox1.Text)
        Ty = Val(TextBox2.Text)
 
        Dim azda(Tx, Ty) As PictureBox
 
        posx = Pic_0_0.Location.X
        posy = Pic_0_0.Location.Y
 
        Do While Cy <= Ty
            'Affichage des PictureBox
            azda(Cx, Cy) = New System.Windows.Forms.PictureBox()
 
            azda(Cx, Cy).BackColor = System.Drawing.SystemColors.ButtonHighlight
            azda(Cx, Cy).Location = New System.Drawing.Point(posx + Cx * 20, posy + Cy * 20)
            azda(Cx, Cy).Size = New System.Drawing.Size(20, 20)
            azda(Cx, Cy).Name = "pic_" + Cx.ToString() + "_" + Cy.ToString()
 
            Me.Controls.Add(azda(Cx, Cy))
 
            Cx += 1
            If Cx > Tx Then
                Cx = 0
                Cy += 1
                If Cy > Ty Then
                    Return
                End If
            End If
 
        Loop
Merci