-
循环遍历获取控件
List<LQOutPutCheckBox.LQOutPutCheckBox> AllLQOutputCheckControls = new List<LQOutPutCheckBox.LQOutPutCheckBox>();
List<LQOutPutCheckBox.LQInputCheckBox> AllLQInputCheckControls = new List<LQOutPutCheckBox.LQInputCheckBox>();
private void IOControlForm_Load(object sender, EventArgs e)
{
AllLQOutputCheckControls.Clear();
AllLQInputCheckControls.Clear();
GetAllControls_out(this, ref AllLQOutputCheckControls);
GetAllControls_in(this, ref AllLQInputCheckControls);
IsOnThread = true;
CheckStateThread = new Thread(RefreshIO);
CheckStateThread.Start();
}private void GetAllControls_out(Control tempParentControl, ref List<LQOutPutCheckBox.LQOutPutCheckBox> tenpControlList)//循环遍历获得所有LQ控件 { foreach (Control ctl in tempParentControl.Controls)//groupBox2.Controls) { LQOutPutCheckBox.LQOutPutCheckBox xxx = ctl as LQOutPutCheckBox.LQOutPutCheckBox; if (xxx != null) { Console.WriteLine("添加控件--" + ctl.Name); //xxx.MouseEnter += new System.EventHandler(this.SteelInputSideStopper_MouseEnter); tenpControlList.Add(xxx); continue; } //Console.WriteLine(ctl.Name); if (ctl.Controls.Count > 0) { Console.WriteLine("父控件---" + ctl.Name); GetAllControls_out(ctl, ref tenpControlList); } //else //{ // //Console.WriteLine("添加控件--" + ctl.Name); // //LQOutPutCheckBox.LQOutPutCheckBox xxx = ctl as LQOutPutCheckBox.LQOutPutCheckBox; // //if (xxx != null) // //{ // // Console.WriteLine("添加控件--", ctl.Name); // // //xxx.MouseEnter += new System.EventHandler(this.SteelInputSideStopper_MouseEnter); // // AllInpot.Add(xxx); // //} //} } } private void GetAllControls_in(Control tempParentControl, ref List<LQOutPutCheckBox.LQInputCheckBox> tenpControlList)//循环遍历获得所有LQ控件 { foreach (Control control in tempParentControl.Controls) { LQOutPutCheckBox.LQInputCheckBox tempInputControl = control as LQOutPutCheckBox.LQInputCheckBox; if (tempInputControl != null) { Console.WriteLine("添加控件--" + control.Name); tenpControlList.Add(tempInputControl); continue; } //Console.WriteLine(ctl.Name); if (control.Controls.Count > 0) { Console.WriteLine("父控件---" + control.Name); GetAllControls_in(control, ref tenpControlList); } } } private void RefreshIO() { while (IsOnThread == true && GlobalClass.FormClose == false) { if (AllLQOutputCheckControls != null)//刷新输出口LQ { foreach (LQOutPutCheckBox.LQOutPutCheckBox item in AllLQOutputCheckControls) { item.RefreshInputPortState(); } } if (IsOnThread == false) return; if (AllLQInputCheckControls != null)//刷新LQ输入口 { foreach (LQOutPutCheckBox.LQInputCheckBox item in AllLQInputCheckControls) { item.RefreshInputPortState(); } } } }
导出与导入
导出
如果你想尝试使用此编辑器, 你可以在此篇文章任意编辑。当你完成了一篇文章的写作, 在上方工具栏找到 文章导出 ,生成一个.md文件或者.html文件进行本地保存。
导入
如果你想加载一篇你写过的.md文件或者.html文件,在上方工具栏可以选择导入功能进行对应扩展名的文件导入,
继续你的创作。