//void RefreshLinkageWindowControl(CWindowControl WindowControl) //{ // List<Control> lstCtrls = new List<Control>(); // foreach (Control ctrl in panelTop.Controls) // lstCtrls.Add(ctrl); // foreach (Control ctrl in panelBottom.Controls) // lstCtrls.Add(ctrl); // foreach (Control ctrl in panelLeft.Controls) // lstCtrls.Add(ctrl); // foreach (Control ctrl in panelRight.Controls) // lstCtrls.Add(ctrl); // foreach (Control ctrl in panelFill.Controls) // lstCtrls.Add(ctrl); // List<CBaseObject> lstLT = WindowControl.LinkageWindowControlMgr.GetList(); // foreach (CBaseObject obj in lstLT) // { // CLinkageWindowControl LinkageWindowControl = (CLinkageWindowControl)obj; // CWindowControl swc = (CWindowControl)WindowControl.m_ObjectMgr.Find(LinkageWindowControl.SlaveID); // if (swc != null) // { // foreach (Control ctrl in lstCtrls) // { // if ((CWindowControl)(ctrl.Tag) == swc) // { // IWindowCtrl winCtrl = (IWindowCtrl)ctrl; // if (winCtrl.GetCtrlType() == ControlType.TableGrid) // { // TableGrid teLT = (TableGrid)ctrl; // CTableInWindowControl tiw = teLT.TableInWindowControl; // string sQueryFilter = tiw.QueryFilter; // if (CalcUIFormula(ref sQueryFilter)) // { // teLT.BaseObjectMgr.GetList(sQueryFilter); // teLT.LoadData(); // } // } // else if (winCtrl.GetCtrlType() == ControlType.TableTab) // { // TableTab tabLT = (TableTab)ctrl; // foreach (TabPage page in tabLT.tabControl.TabPages) // { // TableGrid teLT = (TableGrid)page.Controls[0]; // CTableInWindowControl tiw = teLT.TableInWindowControl; // string sQueryFilter = tiw.QueryFilter; // if (CalcUIFormula(ref sQueryFilter)) // { // teLT.BaseObjectMgr.GetList(sQueryFilter); // teLT.LoadData(); // } // } // } // else if (winCtrl.GetCtrlType() == ControlType.ListBox) // { // UIListBox listBoxLT = (UIListBox)ctrl; // CTableInWindowControl tiw = listBoxLT.TableInWindowControl; // string sQueryFilter = tiw.QueryFilter; // if (CalcUIFormula(ref sQueryFilter)) // { // listBoxLT.BaseObjectMgr.GetList(sQueryFilter); // listBoxLT.LoadData(); // } // } // else if (winCtrl.GetCtrlType() == ControlType.ComboBox) // { // UIComboBox combBoxLT = (UIComboBox)ctrl; // CTableInWindowControl tiw = combBoxLT.TableInWindowControl; // string sQueryFilter = tiw.QueryFilter; // if (CalcUIFormula(ref sQueryFilter)) // { // combBoxLT.BaseObjectMgr.GetList(sQueryFilter); // combBoxLT.LoadData(); // } // } // } // } // } // } //} void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridView dv = (DataGridView)sender; TableGridF te = (TableGridF)dv.Parent; CFormControl FormControl = (CFormControl)te.Tag; //RefreshLinkageWindowControl(WindowControl); }
void LoadData() { if (FormF == null) { return; } this.Width = FormF.Width; this.Height = FormF.Height; List <CBaseObject> lstFormControl = FormF.FormControlMgr.GetList(); foreach (CBaseObject obj in lstFormControl) { CFormControl FormControl = (CFormControl)obj; if (FormControl.CtrlType == (int)ControlType.TableGrid) { if (FormControl.TableInFormControlMgr.GetList().Count == 0) { continue; } CTableInFormControl TableInFormControl = (CTableInFormControl)FormControl.TableInFormControlMgr.GetFirstObj(); CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInFormControl.FW_Table_id); if (table == null) { continue; } CBaseObjectMgr objMgr = new CBaseObjectMgr(); objMgr.TbCode = table.Code; objMgr.Ctx = Program.Ctx; TableGridF te = new TableGridF(); te.TableInFormControl = TableInFormControl; te.BaseObjectMgr = objMgr; te.Name = FormControl.Name; te.ShowToolBar = TableInFormControl.ShowToolBar; te.ShowTitleBar = TableInFormControl.ShowTitleBar; te.CaptionText = FormControl.Name; te.Tag = FormControl; flowPanel.Controls.Add(te); te.dataGridView.CellClick += new DataGridViewCellEventHandler(dataGridView_CellClick); } else if (FormControl.CtrlType == (int)ControlType.TableTree) { TableTreeF tt = new TableTreeF(); tt.CaptionText = FormControl.Name; tt.ShowTitleBar = FormControl.ShowTitleBar; tt.FormControl = FormControl; tt.Name = FormControl.Name; tt.Tag = FormControl; flowPanel.Controls.Add(tt); tt.Dock = DockStyle.Fill; tt.BringToFront(); tt.treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeView_NodeMouseClick); } else if (FormControl.CtrlType == (int)ControlType.TableTab) { TableTabF tab = new TableTabF(); tab.FormControl = FormControl; tab.CaptionText = FormControl.Name; tab.Name = FormControl.Name; tab.ShowTitleBar = FormControl.ShowTitleBar; tab.Tag = FormControl; flowPanel.Controls.Add(tab); tab.Dock = DockStyle.Fill; tab.BringToFront(); } else if (FormControl.CtrlType == (int)ControlType.ComboBox) { if (FormControl.TableInFormControlMgr.GetList().Count == 0) { continue; } CTableInFormControl TableInFormControl = (CTableInFormControl)FormControl.TableInFormControlMgr.GetFirstObj(); CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInFormControl.FW_Table_id); if (table == null) { continue; } CBaseObjectMgr objMgr = new CBaseObjectMgr(); objMgr.TbCode = table.Code; objMgr.Ctx = Program.Ctx; UIComboBoxF cb = new UIComboBoxF(); cb.CaptionText = FormControl.Name + ":"; cb.TableInFormControl = TableInFormControl; cb.BaseObjectMgr = objMgr; cb.Name = FormControl.Name; cb.Tag = FormControl; flowPanel.Controls.Add(cb); cb.Dock = DockStyle.Top; cb.BringToFront(); cb.comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged); } else if (FormControl.CtrlType == (int)ControlType.ListBox) { if (FormControl.TableInFormControlMgr.GetList().Count == 0) { continue; } CTableInFormControl TableInFormControl = (CTableInFormControl)FormControl.TableInFormControlMgr.GetFirstObj(); CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInFormControl.FW_Table_id); if (table == null) { continue; } CBaseObjectMgr objMgr = new CBaseObjectMgr(); objMgr.TbCode = table.Code; objMgr.Ctx = Program.Ctx; UIListBoxF listBox = new UIListBoxF(); listBox.CaptionText = FormControl.Name; listBox.TableInFormControl = TableInFormControl; listBox.BaseObjectMgr = objMgr; listBox.Name = FormControl.Name; listBox.Tag = FormControl; flowPanel.Controls.Add(listBox); listBox.Dock = DockStyle.Fill; listBox.BringToFront(); listBox.listBox.SelectedIndexChanged += new EventHandler(listBox_SelectedIndexChanged); } } }