private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int c = xtraTabControl1.TabPages.Count; for (int i = 0; i < c; i++) { string tabName = "FindLabelHistory"; if (xtraTabControl1.TabPages[i].Text.ToString() == tabName) { xtraTabControl1.SelectedTabPage = xtraTabControl1.TabPages[i]; return; } } XtraTabPage p1 = xtraTabControl1.TabPages.Add("FindLabelHistory"); XtraPanel panel = new XtraPanel(); p1.Controls.Add(panel); ucFindLabel u1 = new ucFindLabel(xtraTabControl1, p1); panel.Controls.Add(u1); panel.Show(); panel.Dock = DockStyle.Fill; xtraTabControl1.SelectedTabPage = p1; }
/// <summary> /// XtraPanel 내에 포함된 모든 DevExpress 컴포넌트에 대해 바탕색 및 선택 색상 지정. /// - BaseEdit 상속 컴포넌트에 대해 지정 /// - 단, CheckEdit, RadioGroup 컴포넌트는 제외 /// - 컴포넌트의 Tag Property에 "Y" 설정되면 필수 처리, 이외의 경우에는 일반. /// </summary> /// <param name="container">폼 객체</param> static public void SetColorContainerCtrl(XtraPanel container) { try { if (container == null) { return; } int len = container.Controls.Count; for (int i = 0; i < len; i++) { if (container.Controls[i] is RadioGroup) { // RODIO도 설정하지 않음. 단, Radio는 TabStop false 설정. (container.Controls[i] as RadioGroup).TabStop = false; continue; } if (container.Controls[i] is DevExpress.XtraEditors.BaseEdit) { // 입력 컨트롤 설정. DevExpress.XtraEditors.BaseEdit edt = container.Controls[i] as DevExpress.XtraEditors.BaseEdit; if (edt != null) { // CHECK BOX는 설정하지 않음 if (edt is CheckEdit) { continue; } if (edt.Properties.ReadOnly) { edt.TabStop = false; } ChangeBkColor(edt); edt.Enter += new EventHandler(OnCommonEnter); edt.Leave += new EventHandler(OnCommonLeave); } } } } catch (Exception ex) { string s = ex.Message; } }
/// <summary> /// Insert the rendering control and associated tools into the display panel /// </summary> public override void InsertRenderingControlIntoDisplayPanel( XtraPanel viewPanel) { viewPanel.Controls.Clear(); // remove anything in there viewPanel.Controls.Add(GridPanel); // add it to the display panel InsertToolsIntoDisplayPanel(); GridPageControl.EditQueryButton.Enabled = ViewManager.IsControlContainedInQueriesControl(viewPanel) || ViewManager.IsCustomExitingQueryResultsCallbackDefined(viewPanel); if (Qrc == null || BaseQuery == null) { return; } Qrc.SetToolBarTools(GridPageControl.ToolPanel, BaseQuery.ViewScale); // show the proper tools and zoom return; }
/// <summary> /// Insert the rendering control and associated tools into the display panel /// </summary> public override void InsertRenderingControlIntoDisplayPanel( XtraPanel viewPanel) { SubQuerySelectedView.InsertRenderingControlIntoDisplayPanel(viewPanel); // should handle tools as well return; }
/// <summary> /// Render the views in prebuilt DockPanel layout /// </summary> internal void RenderViews() { ResultsViewProps view = null; XtraPanel viewPanel; // panel that contains current view control and is contained in a docking panel or directly in the views panel if single view on page DockPanel activePanel = null; ResultsPage page = ResultsPage; if (page == null) { return; } List <ResultsViewProps> views = page.Views; if (views.Count == 0) // just have a single blank panel if no views { RenderEmptyPage(); return; } // See if single view without DockPanels else if (ResultsPage.Views.Count == 1 && Controls.Count == 1 && Controls[0] is XtraPanel) { view = ResultsPage.Views[0]; viewPanel = Controls[0] as XtraPanel; ConfigureViewInPanel(view, viewPanel); return; } // Scan the set of DockPanels and render the view associated with each panel else { DockManager dm = DockManager; foreach (DockPanel dp0 in dm.Panels) { view = dp0.Tag as ResultsViewProps; if (view == null) { continue; } Control.ControlCollection cc = dp0.ControlContainer.Controls; cc.Clear(); viewPanel = new XtraPanel(); // the panel that will contain the view control viewPanel.Dock = DockStyle.Fill; viewPanel.BackColor = Color.White; cc.Add(viewPanel); ConfigureViewInPanel(view, viewPanel); SetupDockPanel(dp0, view, viewPanel); if (view == page.ActiveView) { activePanel = dp0; // save ref to active panel } } if (activePanel != null) { DockManager.ActivePanel = activePanel; } return; } }
/// <summary> /// Layout views in even rows and columns /// </summary> void CreateRowsAndColsLayoutAndRenderViews() { DockPanel dp, rowDp, lastRp = null, lastDp = null, activePanel = null; int vi, ri, ci; if (ResultsPage.Views.Count < 3) // if less than three views do a simple side by side { CreateCommonLayoutAndRenderViews(ViewLayout.SideBySide); return; } DockManager dm = DockManager; dm.Clear(); Controls.Clear(); int pc = dm.Panels.Count; int rpc = dm.RootPanels.Count; List <ResultsViewProps> views = ResultsPage.Views; if (views.Count == 0) { return; } double d = Math.Sqrt(views.Count); if ((int)d != d) { d += 1; } int cols = (int)d; if (cols < 1) { cols = 1; } int rows = (views.Count + (cols - 1)) / cols; if (rows < 1) { rows = 1; } int width = (int)(Width / (double)cols + .5); int height = (int)(Height / (double)rows + .5); DockPanel masterPanel = null; List <DockPanel> rowPanels = new List <DockPanel>(); List <DockPanel> viewPanels = new List <DockPanel>(); // Create master panel and one panel per row for (ri = 0; ri < rows; ri++) { if (ri == 0) // first row, create first panel { dp = dm.AddPanel(DockingStyle.Left); } else if (ri == 1) // 2nd row, add panel to first panel create row splitter { dp = rowPanels[0].AddPanel(); masterPanel = dm.RootPanels[0]; masterPanel.Size = Size; //masterPanel.DockVertical = DefaultBoolean.False; // (not needed) } else // subsequent row, add panel to row splitter { dp = masterPanel.AddPanel(); } rowPanels.Add(dp); } // Add column/cell panel members to each row panel for (vi = 0; vi < views.Count; vi++) { ri = vi / cols; ci = vi % cols; DockPanel rp = rowPanels[ri]; if (ci == 0) // first col, create first panel { dp = rp; // get single panel } else if (ci == 1) // 2nd col, add panel to first panel create splitter to contain cell panels { dp = rp.AddPanel(); rp = rowPanels[ri] = dp.ParentPanel; // store new parent //rp.DockVertical = DefaultBoolean.True; // (not needed) } else // subsequent row, add panel to row splitter { dp = rp.AddPanel(); } viewPanels.Add(dp); lastDp = dp; ResultsViewProps view = views[vi]; XtraPanel viewPanel = new XtraPanel(); // the panel that will contain the view control, goes into a DockPanel or directly into the viewsPanel if only one view viewPanel.Dock = DockStyle.Fill; // it will fill its containing panel SetupDockPanel(dp, view, viewPanel); if (ResultsPage.ActiveViewIndex == vi) { activePanel = dp; } } if (activePanel != null) // set the active panel { dm.ActivePanel = activePanel; } ResultsPage.LastLayout = ViewLayout.RowsAndCols; return; }
/// <summary> /// Render views for stacked, side by side or tabbed /// </summary> void CreateCommonLayoutAndRenderViews(ViewLayout layout) { DockPanel pdp = null; // parent dock panel which is a vertical or horizontal split panel or a tab panel DockPanel dp = null; // current docking panel that contains the view panel & is stored in the ResultsDisplayPanel DockPanel lastDp = null; XtraPanel viewPanel; // panel that contains current view control and is contained in a docking panel or directly in the views panel if single view on page ResultsViewProps view; DockingStyle dockingStyle = DockingStyle.Top; if (layout == ViewLayout.SideBySide) { dockingStyle = DockingStyle.Top; ResultsPage.LastLayout = layout; } else if (layout == ViewLayout.Stacked) { dockingStyle = DockingStyle.Left; ResultsPage.LastLayout = layout; } else if (layout == ViewLayout.Tabbed) { dockingStyle = DockingStyle.Left; ResultsPage.TabbedLayout = true; // set flag indicating tabbed layout } ResultsPage page = ResultsPage; List <ResultsViewProps> views = page.Views; DockManager dm = DockManager; dm.Clear(); DockPanel activePanel = null; for (int vi = 0; vi < views.Count; vi++) { view = views[vi]; viewPanel = new XtraPanel(); // the panel that will contain the view control, goes into a DockPanel or directly into the viewsPanel if only one view viewPanel.Dock = DockStyle.Fill; // it will fill its containing panel if (views.Count == 1) // if just one view then let it use the full panel (no DockPanel with view header) { Controls.Add(viewPanel); } else // create a new DockPanel, add the viewPanel to it and { if (vi == 0) // first panel, add to DockManager { dp = dm.AddPanel(dockingStyle); } else if (vi == 1) // 2nd panel, add to first which creates splitter { dp = lastDp.AddPanel(); } else // additional panels are just added to splitter { dp = dm.RootPanels[0].AddPanel(); } lastDp = dp; SetupDockPanel(dp, view, viewPanel); if (page.ActiveViewIndex == vi) { activePanel = dp; } } } // view loop if (activePanel != null) // set the active panel { dm.ActivePanel = activePanel; } if (dm.RootPanels.Count > 0) { dm.RootPanels[0].Size = Size; } if (layout == ViewLayout.SideBySide) { foreach (DockPanel dp0 in dm.Panels) { if (dp0.Count == 0) { dp0.Height = Height; } } //dp0.Width = (int)(Width / (double)views.Count + .5); } else if (layout == ViewLayout.Stacked) { foreach (DockPanel dp0 in dm.Panels) { if (dp0.Count == 0) { dp0.Width = Width; } } //dp0.Height = (int)(Height / (double)views.Count + .5); } else if (layout == ViewLayout.Tabbed && dm.RootPanels.Count > 0) { SetupTabbedPanel(dm.RootPanels[0]); // make it tabbed } return; }