//FORM4
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AinB
{
public partial class Data : Form
{
public string FName;
public string MacName;
public Data()
{
InitializeComponent();
}
private void Data_Load(object sender, EventArgs e)
{
//ToB toB=(ToB)this.Owner;
//string MacName = toB.Controls["选择"].Text;
string[] ButName = { "提 交", "返 回" };
Label labName = new Label();
labName.Text = FName;
labName.Location = new Point(50, 20);
labName.Size = new Size(50, 20);
Datapanel.Controls.Add(labName);
Label Toplab = new Label();
Toplab.Text = $"{MacName}实测录入";
Toplab.Location = new Point(200,20);
Toplab.Size = new Size(150,20);
Datapanel.Controls.Add(Toplab);
for (int i=0;i<5;i++)
{
Label Maclab = new Label();
Maclab.Name = "D_" + i.ToString();
Maclab.Text = $"{MacName}数据" + (i+1).ToString() + ":";
Maclab.Location = new Point(70, 63 + 50 * i);
Maclab.Size = new Size(83, 25);
Datapanel.Controls.Add(Maclab);
TextBox Macbox = new TextBox();
Macbox.Name = "T_" + i.ToString();
Macbox.Location = new Point(158, 63 + 49 * i);
Macbox.Size = new Size(200, 25);
Datapanel.Controls.Add(Macbox);
if (i < 2)
{
Button Bbut = new Button();
Bbut.Text = ButName[i];
Bbut.BackColor = Color.SkyBlue;
Bbut.Location = new Point(100+150 * i , 310);
Bbut.Size = new Size(80, 25);
Bbut.Click += new EventHandler(But_Click);
Datapanel.Controls.Add(Bbut);
}
}
}
private void But_Click(object sender ,EventArgs e)
{
Button but = sender as Button;
try
{
if(but.Text== "提 交")
{
MessageBox.Show("提交数据成功");
}
else if (but.Text == "返 回")
{
MessageBox.Show("返回");
}
}
catch { }
}
}
}