我正在尝试comboboxes
在动态创建的对象上创建 4,panel
但没有显示任何内容。我在这里缺少什么,这是我的代码:
public partial class Form1 : Form
{
ComboBox[] cmb;
public Form1()
{
InitializeComponent();
}
Panel pnl;
private void Form1_Load(object sender, EventArgs e)
{
panel();
createCombo();
}
private void panel()
{
pnl= new Panel();
pnl.Location = new Point(10, 10);
pnl.BorderStyle = BorderStyle.FixedSingle;
pnl.Size = new Size(200, 150);
this.Controls.Add(pnl);
createCombo();
}
private void createCombo()
{
for (int i = 0; i <= 3; ++i)
{
cmb[i] = new ComboBox();
cmb[i].Text = "CodeCall!";
cmb[i].Size = new Size(90, 00);
cmb[i].Location = new Point(i+5, 0);
pnl.Controls.Add(cmb[i]);
}
}
}
界面只显示面板: