Пример #1
0
        private void InitStation()
        {
            m_mapSubCenterPage = new Dictionary <int, CDataGridTabPage>();
            m_tabControl.SuspendLayout();
            m_dgvAllPage = new CDataGridTabPage()
            {
                Title = "所有站点", BTabRectClosable = false
            };
            m_dgvAllPage.DataGrid = new CDataGridViewSoilRTD()
            {
                AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            };
            m_dgvAllPage.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3);
            m_tabControl.AddPage(m_dgvAllPage);

            // 添加分中心
            List <CEntitySubCenter> listSubCenter = CDBDataMgr.Instance.GetAllSubCenter();

            for (int i = 0; i < listSubCenter.Count; ++i)
            {
                CDataGridTabPage tmp = new CDataGridTabPage()
                {
                    Title = listSubCenter[i].SubCenterName, BTabRectClosable = false
                };
                m_mapSubCenterPage.Add(listSubCenter[i].SubCenterID, tmp);
                tmp.DataGrid = new CDataGridViewSoilRTD()
                {
                    AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
                };
                tmp.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3);
                m_tabControl.AddPage(tmp);
                //(tmp.DataGrid as CDataGridViewSoilRTD).RecalculateHeaderSize(); //计算表头宽度
            }

            // 绑定消息,分中心变更消息
            CDBDataMgr.Instance.SubCenterUpdated += new EventHandler(this.EHSubCenterChanged);
            // 收到RTD消息
            CDBSoilDataMgr.Instance.RecvedRTDSoilData += new EventHandler <CEventSingleArgs <CEntitySoilData> >(EHRecvRTD);
            // 收到清空RTD消息
            CDBSoilDataMgr.Instance.RTDSoilDataClear += new EventHandler(EHClearRTD);

            m_tabControl.ResumeLayout(false);

            // 开启定时器
            m_timer.Start();

            //(m_dgvAllPage.DataGrid as CDataGridViewSoilRTD).RecalculateHeaderSize();
        }
Пример #2
0
        private void InitSubCenterLayout()
        {
            m_mapSubCenterPage = new Dictionary <int, CListViewTabPage>();
            m_tabControl.SuspendLayout();
            m_lvStationStateAllPage = new CListViewTabPage()
            {
                Title = "所有站点", BTabRectClosable = false
            };
            m_lvStationStateAllPage.Padding  = new System.Windows.Forms.Padding(0, 0, 0, 3);
            m_lvStationStateAllPage.ListView = new CListViewStationState()
            {
                BHorizentalScroolVisible = false
            };                                                                                                  //, PageRowCount = 300 };

            m_tabControl.AddPage(m_lvStationStateAllPage);
            // 添加分中心
            List <CEntitySubCenter> listSubCenter = CDBDataMgr.Instance.GetAllSubCenter();

            for (int i = 0; i < listSubCenter.Count; ++i)
            {
                CListViewTabPage tmp = new CListViewTabPage()
                {
                    Title = listSubCenter[i].SubCenterName, BTabRectClosable = false
                };
                tmp.Padding  = new System.Windows.Forms.Padding(0, 0, 0, 3);
                tmp.ListView = new CListViewStationState()
                {
                    BHorizentalScroolVisible = false
                };                                                                              //, PageRowCount = 300 };

                m_mapSubCenterPage.Add(listSubCenter[i].SubCenterID, tmp);
                m_tabControl.AddPage(tmp);
            }

            m_tabControl.ResumeLayout(false);
        }