using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Aitex.Core.Backend { public partial class IoDataView : UserControl { public IoDataView() { InitializeComponent(); _views.Add(_diView); _views.Add(_doView); _views.Add(_aiView); _views.Add(_aoView); foreach (var item in _views) { item.Hide(); this.splitContainer1.Panel2.Controls.Add(item); } _diView.Show(); } List _views = new List(); DI _diView = new DI(); DO _doView = new DO(); AI _aiView = new AI(); AO _aoView = new AO(); /// /// 切换仿真子界面 /// /// /// private void rbtBath_CheckedChanged(object sender, EventArgs e) { var rbt = (RadioButton)sender; if (rbt.Checked) { foreach (var usc in _views) usc.Hide(); switch (rbt.Text) { case "DI": _diView.Show(); break; case "DO": _doView.Show(); break; case "AI": _aiView.Show(); break; case "AO": _aoView.Show(); break; } } foreach (RadioButton bt in splitContainer1.Panel1.Controls) { if(bt != null) bt.BackColor = (rbt == bt) ? Color.Green : Color.LightCyan; } } public void Close() { ((IIOView)_diView).Close(); ((IIOView)_doView).Close(); ((IIOView)_aiView).Close(); ((IIOView)_aoView).Close(); } } }