c#如何显示多个动态标签和按钮?

时间:2017-03-01 06:37:34

标签: c# .net

我是c#的新手。我正在尝试构建一个打印标签结果的应用程序。我有2个表单,其中form1将值返回到form2。我使用get和set方法在form2中显示这些值。我只想在form2上的多个标签中显示这些值,并在每个标签前面显示一个按钮..

namespace Loans
{
    public partial class Form2 : Form
    {
        Label labels = new Label();

        public Form2()
        {
            InitializeComponent();
        }

        public string DisplayThis
        {
            get
            {
                labels= new Label(); //cant create multiple labels
                return labels.Text;
            }
            set
            {
                labels.Text = value;
            }
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;
            int height = Screen.PrimaryScreen.Bounds.Height;
            int width = Screen.PrimaryScreen.Bounds.Width;
        }
    }
}

0 个答案:

没有答案