修改FlowLayoutPanel中动态添加的元素

本文关键字:元素 添加 动态 FlowLayoutPanel 修改 | 更新日期: 2023-09-27 18:24:42

如何修改FlowLayoutPanel中动态添加的元素?

我创建标签并将其添加到面板中。

`for (int i=0; i<10; i++)
{
Label nlabel = new Label();
nlabel.text = "Label no."+i.toString();
nlabel.name = "label"+i.toString();
flowLayoutPanel1.Controls.Add(nlabel);.
}`  

在创建和添加之后,我想引用元素"I"。面板没有方法FlowLayoutPanel.getItem(int index);(

怎么做?

ans.

修改FlowLayoutPanel中动态添加的元素

的Thx

与所有控件一样,FlowLayoutPanel也有一个Controls集合属性,您可以按序号或名称对其进行索引。