/// <summary> /// RawDataImport方法,将数据从Excel表格读取到RawDataFrm中的DataGridView中 /// </summary> /// <param name="filePath"></param> private void RawDataImport(string filePath, object objList) { string areaName = ""; int flag; ImportingRawDataBLL iRdb = new ImportingRawDataBLL(); //RawDataFrm 构造方法,以TabPage_Close方法为实参,从而实现了委托中的关闭页面的操作 //使用委托,通过构造函数,将主窗体的TabPage_Close方法传递给子窗体 RawDataFrm RawDataFrm rawDataFrm = new RawDataFrm(TabPage_Close);//实现关闭页面的委托 rawDataFrm.TopLevel = false; XtraTabPage tabPage = new XtraTabPage(); rawDataFrm.Width = workAreaTabPageController.Width - 5; rawDataFrm.Height = workAreaTabPageController.Height; rawDataFrm.rawDataGridView.Height = rawDataFrm.Height - 80; rawDataFrm.btnImport.Location = new System.Drawing.Point(rawDataFrm.Width - 260, rawDataFrm.Height - 70); rawDataFrm.btnCancle.Location = new System.Drawing.Point(rawDataFrm.Width - 160, rawDataFrm.Height - 70); flag = LoadList(rawDataFrm, iRdb, filePath, objList, out areaName); if (flag != 0) { tabPage.Text = areaName + "数据导入预览"; workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(tabPage.Text); workAreaTabPageController.SelectedTabPage.Controls.Add(rawDataFrm); workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage); rawDataFrm.Show(); } }
private void sideBar_BtnBrowse_Click(object sender, EventArgs e) { RawDataFrm rawDataFrm = new RawDataFrm(TabPage_Close); rdf = rawDataFrm; rawDataFrm.TopLevel = false; XtraTabPage tabPage = new XtraTabPage(); rawDataFrm.Width = workAreaTabPageController.Width - 5; rawDataFrm.Height = workAreaTabPageController.Height; rawDataFrm.rawDataGridView.Height = rawDataFrm.Height - 80; rawDataFrm.btnImport.Visible = false; rawDataFrm.btnCancle.Location = new System.Drawing.Point(rawDataFrm.Width - 160, rawDataFrm.Height - 70); LoadList(rawDataFrm); tabPage.Text = "目标区_数据浏览"; workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(tabPage.Text); workAreaTabPageController.SelectedTabPage.Controls.Add(rawDataFrm); workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage); //workAreaTabPageController.TabPages.Remove (x=>x) rawDataFrm.Show(); }