public FrmSSJ(SSJ_Dev ssj_dev, int tag) { this.InitializeComponent(); this.ssj_dev = ssj_dev; this.tag = tag; this.Text = ssj_dev.deviceId[tag] + "的状态及手动控制窗口"; //if (ssj_dev.controlType[tag].Trim().Length > 0) //{ // this.rdButton = new RadioButton[ssj_dev.mainFrm.deviceControlDic.Count]; // int index = 0; // foreach (string str in ssj_dev.mainFrm.deviceControlDic.Keys) // { // if (ssj_dev.mainFrm.deviceControlDic[str].controlType == ssj_dev.controlType[tag]) // { // this.rdButton[index] = new RadioButton(); // this.rdButton[index].Name = ssj_dev.mainFrm.deviceControlDic[str].controlId; // this.rdButton[index].Text = ssj_dev.mainFrm.deviceControlDic[str].controlDesc; // this.rdButton[index].Location = new Point(20 + ((index % 2) * 160), 20 + (30 * (index / 2))); // this.rdButton[index].Font = new Font("宋体", 12f, FontStyle.Regular, GraphicsUnit.Point, 0x86); // this.rdButton[index].Size = new Size(150, 20); // this.groupBox1.Controls.Add(this.rdButton[index]); // this.rdButton[index].CheckedChanged += new EventHandler(this.radioButton_CheckedChanged); // index++; // } // } // this.rdButton[0].Checked = true; // this.strCommand = this.rdButton[0].Name; //} //else //{ // this.groupBox1.Visible = false; // this.btnSendCommand.Visible = false; //} this.RefrushStatus(tag); }
public FrmSSJ(SSJ_Dev ssj_dev, int tag) { InitializeComponent(); this.ssj_dev = ssj_dev; this.tag = tag; this.Text = ssj_dev.deviceId[tag] + "的状态及手动控制窗口"; //是否进行手动控制 if (ssj_dev.controlType[tag].Trim().Length > 0) { rdButton = new RadioButton[ssj_dev.mainFrm.deviceControlDic.Count]; int i = 0; foreach (string str in ssj_dev.mainFrm.deviceControlDic.Keys) { if (ssj_dev.mainFrm.deviceControlDic[str].controlType == ssj_dev.controlType[tag]) { rdButton[i] = new RadioButton(); rdButton[i].Name = ssj_dev.mainFrm.deviceControlDic[str].controlId; rdButton[i].Text = ssj_dev.mainFrm.deviceControlDic[str].controlDesc; rdButton[i].Location = new Point(20 + i % 2 * 160, 20 + 30 * (int)(i / 2)); rdButton[i].Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))); rdButton[i].Size = new Size(150, 20); this.groupBox1.Controls.Add(rdButton[i]); rdButton[i].CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); i++; } } rdButton[0].Checked = true; strCommand = rdButton[0].Name; } else { this.groupBox1.Visible = false; btnSendCommand.Visible = false; } RefrushStatus(tag); }