0

コミュニティの助けのおかげで、タブ コントロール内に動的なラベルを配置し、値をリストに保存して、好きなように呼び出すことができました。次の質問に進みます。動的ラベルごとにすべての単一行を出力したい場合、どうすればよいでしょうか? 以下は私のコードです:

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);
        }
    }
4

0 に答える 0