标签不显示在c#窗口窗体App中

时间:2016-05-21 08:27:45

标签: c# winforms

我正在使用此代码,但它只显示newlabelName

        foreach (var type in obj.sType)
        {
            Label newLabelForName = new Label
            {
                Text = type.sName,
                Font = new Font("Arial", 16),
                AutoSize = false,
                BackColor = Color.Red,
                Width = formObject.panelDetail.Width
            };
            Label newLabelForPrice = new Label
            {
                Text = "Price : " + type.fPrice ,
                Font = new Font("Arial", 16),
            };
            Label newLabelForQuantity = new Label
            {
                Text = "Quantity : " + type.sQuantity,//newLabelForName.Text + Environment.NewLine + newLabelForPrice,
                Font = new Font("Arial", 16)

            };
            formObject.panelDetail.Controls.Add(newLabelForName);
            formObject.panelDetail.Controls.Add(newLabelForPrice);
            formObject.panelDetail.Controls.Add(newLabelForQuantity);

        }

sType是对象中的对象数组,我使用sName,fPrice和sQuantity

0 个答案:

没有答案