我如何为每个标签输出每一行?

时间:2013-05-15 00:03:12

标签: c# windows

感谢社区帮助,我已经能够在选项卡控件中放入动态标签,将值保存到列表中,并按照我的意愿调用它。现在转到下一个问题,如果我想为每个动态标签输出每个唱行,我该怎么做? 以下是我的代码:

private void frmYourCart_Load(object sender, EventArgs e)
{
    if (InvoiceRental.GetTitle().Count > 0)
    {
        //page 215
        for (int i = 0; i < InvoiceRental.GetTitle().Count; i++)
        {
            lblConsole.Visible = true;
            lblTitle.Visible = true;
            lblPrice.Visible = true;
            Label resultLabel = new Label();
            resultLabel.AutoSize = true;
            resultLabel.Location = new Point(160, 200);
            resultLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Left);
            resultLabel.Text += String.Format("{0, 50} {1, 50}\n", InvoiceRental.GetTitle()[i], InvoiceRental.GetPrice()[i]);
            this.Controls.Add(resultLabel);
        }
    }

0 个答案:

没有答案