private void EHMI_Soil_Click(object sender, EventArgs e)
 {
     MI_Soil.Checked = !MI_Soil.Checked;
     if (MI_Soil.Checked)
     {
         // 显示
         //m_tabControlUp.AddPage(m_formSoilRTD);
         m_tabControlUp.SelectedIndex = m_tabControlUp.TabCount - 1;
         m_formStationState.Show();
     }
     else
     {
         // 隐藏
         //m_tabControlUp.RemovePage(m_formSoilRTD);
         m_formStationState.Hide();
     }
 }
Beispiel #2
0
        // 初始化自定义控件
        private void InitCustomerControls()
        {
            this.SuspendLayout();
            //m_dataGridLatestData = new CDataGridTabPage() { Title = "实时数据", BTabRectClosable = false };
            //m_dataGridLatestData.DataGrid = new CDataGridViewRTD();
            m_formRTD = new CRTDForm()
            {
                Title = "实时水情数据", BTabRectClosable = false, MdiParent = this
            };
            m_formRTD.Dock = DockStyle.Fill;

            //m_formSoilRTD = new CRTDSoilForm() { Title = "实时墒情数据", BTabRectClosable = false, MdiParent = this };
            //m_formSoilRTD.Dock = DockStyle.Fill;

            m_listFormSystemInfo = new CListFormTabPage()
            {
                Title = "运行日志", BTabRectClosable = false, BCloseButton = false, MdiParent = this, Text = "实时信息"
            };
            m_listFormSystemInfo.Dock = DockStyle.Fill;
            m_listFormSystemInfo.ListView.AutoUpdateLists = true;

            m_listFormComState = new CListFormTabPage()
            {
                Title = "串口状态", BTabRectClosable = false, MdiParent = this, Text = "通讯口状态"
            };
            m_listFormComState.Dock     = DockStyle.Fill;
            m_listFormComState.ListView = new CListViewSerialPortState();
            m_listFormComState.ListView.AutoUpdateLists = true;
            //m_listFormComState.SetMsgViewMode(true);

            m_listFormWarningInfo = new CListFormTabPage()
            {
                Title = "告警信息", BTabRectClosable = false, MdiParent = this, Text = "告警信息2"
            };
            m_listFormWarningInfo.Dock = DockStyle.Fill;
            m_listFormWarningInfo.ListView.AutoUpdateLists = true;

            m_formStationState = new CStationStateForm()
            {
                Title = "站点状态", BTabRectClosable = true, MdiParent = this
            };
            m_formStationState.Dock = DockStyle.Fill;


            m_formRTD.MouseEnter += MainForm_MouseEnter;
            //m_formSoilRTD.MouseEnter += MainForm_MouseEnter;
            m_listFormSystemInfo.MouseEnter  += MainForm_MouseEnter;
            m_listFormComState.MouseEnter    += MainForm_MouseEnter;
            m_listFormWarningInfo.MouseEnter += MainForm_MouseEnter;
            m_formStationState.MouseEnter    += MainForm_MouseEnter;


            #region TABCONTROL

            m_tabControlUp = new CExTabControl();
            m_tabControlUp.SuspendLayout();
            m_tabControlUp.AddPage(m_formRTD);
            //m_tabControlUp.AddPage(m_formSoilRTD);
            //m_tabControlUp.AddPage(m_formStationState);
            //m_tabControlUp.AddPage(m_formSoilRTD);
            splitContainer2.Panel1.Controls.Add(m_tabControlUp);
            m_tabControlUp.ResumeLayout(false);
            //this.m_tabControlUp.MouseDown += (s, e) => { this.m_timer.Stop(); this.m_timer.Start(); MessageBox.Show("up enter"); };

            m_tabControlBottom = new CExTabControl();
            m_tabControlBottom.SuspendLayout();
            m_tabControlBottom.Alignment = TabAlignment.Bottom; //选项卡位于底部
            m_tabControlBottom.AddPage(m_listFormSystemInfo);
            //m_tabControlBottom.AddPage(m_listFormComState);
            //m_tabControlBottom.AddPage(m_listFormWarningInfo); //告警信息
            splitContainer2.Panel2.Controls.Add(m_tabControlBottom);
            m_tabControlBottom.ResumeLayout(false);

            //m_tabControlBottom.MouseDown += (s, e) => { this.m_timer.Stop(); this.m_timer.Start(); MessageBox.Show("bottom enter"); };
            #endregion m_tabControl

            // 初始化表头
            //m_dataGridLatestData.DataGrid.Header = new string[] { "站名", "站点编号", "站点类型", "采集时间", "延迟", "水量", "雨量", "电压", "端口", "报文类型" };
            //m_dataGridView2.Header = new string[] { "站名", "站点编号", "站点类型", "采集时间", "延迟", "水量", "雨量", "电压", "端口", "报文类型" };
            m_listFormSystemInfo.Show();
            m_listFormComState.Show();

            m_formRTD.Show();
            m_formStationState.Show();
            //if (IsLoadSoilRTD())
            //{
            //    this.MI_Soil.Enabled = false;
            //    this.MI_Soil.Checked = true;
            //    this.MI_Soil.Enabled = true;
            //m_formSoilRTD.Show();
            //}
            m_listFormWarningInfo.Show();

            // 加载 CTreeView
            CMainFormAndCTreeViewBridage.LoadTreeView(this, this.m_tabControlUp);

            this.ResumeLayout(false);
        }