Ich habe 8 * 16 Ovalformen in einer Form generiert. Der Code ist:Zugriff auf Elemente in einer Liste
for (int i = 0; i < 16; i++)
{
for (int j = 0; j < 8; j++)
{
OvalShape ovl = new OvalShape();
ovl.Width = 20;
ovl.Height = 20;
ovl.FillStyle = FillStyle.Solid;
ovl.FillColor = Color.Transparent;
ovl.Name = "oval" + j + "" + i;
ovl.Location = new Point((ovl.Width * i) * 2, (ovl.Height * j) * 2);
ovalShape.Add(ovl);
}
}
foreach (OvalShape os in ovalShape)
{
Microsoft.VisualBasic.PowerPacks.ShapeContainer shapeContainer =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
os.Parent = shapeContainer;
this.Controls.Add(shapeContainer);
}
Jetzt möchte ich Zugriff auf jede ovalshape anders. Wie könnte ich das tun?
Welcher Typ ist die Variable 'ovalShape'? – Oded
Bitte erklären Sie, was Sie mit "Ich möchte Zugriff auf jede ovalshape anders" –
@Oded: "Liste" Ich würde raten. 'ovalShapes' wäre ein besserer Name gewesen. –
markmuetz