12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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<UserControl> _views = new List<UserControl>();
- DI _diView = new DI();
- DO _doView = new DO();
- AI _aiView = new AI();
- AO _aoView = new AO();
-
- /// <summary>
- /// 切换仿真子界面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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();
- }
- }
- }
|