private void MainForm_Load(object sender, EventArgs e) { SetDevice(false); myRegisterForm = new RegisterForm(); Data.dt_AD01.Columns.Add("序号", typeof(Int32)); Data.dt_AD01.Columns.Add("名称", typeof(String)); Data.dt_AD01.Columns.Add("测量值", typeof(double)); for (int i = 0; i < 8; i++) { DataRow dr = Data.dt_AD01.NewRow(); dr["序号"] = i + 1; dr["名称"] = "通道" + (i + 1).ToString(); dr["测量值"] = 0; Data.dt_AD01.Rows.Add(dr); } Data.dt_AD02.Columns.Add("序号", typeof(Int32)); Data.dt_AD02.Columns.Add("名称", typeof(String)); Data.dt_AD02.Columns.Add("测量值", typeof(double)); for (int i = 8; i < 16; i++) { DataRow dr = Data.dt_AD02.NewRow(); dr["序号"] = i + 1; dr["名称"] = "通道" + (i + 1).ToString(); dr["测量值"] = 0; Data.dt_AD02.Rows.Add(dr); } myADForm = new ADForm(); }
private void 查看AD数据ToolStripMenuItem_Click(object sender, EventArgs e) { if (Data.AdFrmIsAlive) { myADForm.Activate(); } else { myADForm = new ADForm(); } myADForm.Show(); }