我是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;
}
}
}