我知道我可以使用 listBox.Controls.Add(new Button());
但我需要将多个控件添加为行,最好从列表中添加并将其设置为数据源。我尝试了以下但没有成功:
var list = new List<Control>();
list.Add(new Button());
list.Add(new Button());
list.Add(new Button());
listBox1.DataSource = list;
最佳答案
我决定使用 flowLayoutPanel反而。这似乎是目前最好的选择。
关于c# - 向列表框添加控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19179918/