面板项目不分离

时间:2013-10-29 01:56:05

标签: c#

这适用于Windows桌面,而不是asp.net。我有一个面板,我正在添加项目。现在这些物品正在出现,但彼此重叠。我希望它们用空行隔开。我做错了什么?

string[] stng = { "1", "2" };
foreach (string stng123 in stng)
{
    Panel entryPanel = new Panel();
    Label lbInfo = new Label();
    lbInfo.AutoSize = true;
    lbInfo.Text = "stng123 + Environment.NewLine + "testing";

    Button delButton = new Button();
    delButton.Text = "Delete";
    delButton.Location = new Point(120, 0);
    delButton.Click += (s, e) => { panel1.Controls.Remove(entryPanel); };

    panel1.Controls.Add(entryPanel);
    entryPanel.Controls.Add(lbInfo);
    entryPanel.Controls.Add(delButton);
    entryPanel.BackColor = System.Drawing.Color.FromArgb(100, 255, 240, 0);
}
panel1.Height = (panel1.Controls.Count) + 88;

0 个答案:

没有答案