private void tabBar_PaneCreated(object sender, Syncfusion.Windows.Forms.SplitterPaneEventArgs e) { GridControl grid = e.Control as GridControl; GridMarkHeadersHelper helper = new GridMarkHeadersHelper(grid); helperList.Add(grid, helper); }
private void tabBar_PaneClosing(object sender, Syncfusion.Windows.Forms.SplitterPaneEventArgs e) { GridControl grid = e.Control as GridControl; GridMarkHeadersHelper helper = this.helperList[grid] as GridMarkHeadersHelper; if (helper != null) { this.helperList.Remove(grid); helper.Dispose(); helper = null; } }
private void Form1_Load(object sender, System.EventArgs e) { //helper class to mark headers/row on a the calculation sheet GridMarkHeadersHelper helper = new GridMarkHeadersHelper(this.gridCalculations); helper.RegisterGridForContextMenu(this.gridDisplay); this.helperList = new Hashtable(); this.helperList.Add(this.gridCalculations, helper); //register grids for multisheeted use int sheetFamilyID = GridFormulaEngine.CreateSheetFamilyID(); GridFormulaEngine.RegisterGridAsSheet("Display", this.gridDisplay.Model, sheetFamilyID); GridFormulaEngine.RegisterGridAsSheet("Calc", this.gridCalculations.Model, sheetFamilyID); SetUpDisplaySheet(); SetUpCalcSheet(); SetUpNamedRanges(); //setup copying formulas GridFormulaEngine engine = ((GridFormulaCellModel)this.gridCalculations.CellModels["FormulaCell"]).Engine; engine.FormulaCopyFlags |= GridFormulaCopyFlags.ClipBoardFormula; //make sure calc grid has current cell this.tabBarPage2.ActiveControl = this.gridCalculations; this.gridCalculations.CurrentCell.MoveTo(1, 1); //bring up form on grid in first tab this.tabBarSplitterControl1.ActivePage = this.tabBarPage1; this.tabBarPage1.ActiveControl = this.gridDisplay; this.gridDisplay.CurrentCell.MoveTo(5, 5); this.gridDisplay.Refresh(); //subscribe to TabBar events to handle splitters generating new grids this.tabBarSplitterControl1.PaneCreated += new Syncfusion.Windows.Forms.SplitterPaneEventHandler(tabBar_PaneCreated); this.tabBarSplitterControl1.PaneClosing += new Syncfusion.Windows.Forms.SplitterPaneEventHandler(tabBar_PaneClosing); this.gridCalculations.Properties.GridLineColor = System.Drawing.Color.Silver; this.gridCalculations.DefaultGridBorderStyle = GridBorderStyle.Solid; this.gridCalculations.ThemesEnabled = true; this.Text = "Retirement Simulation Demo"; this.gridCalculations.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridDisplay.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridDisplay.DefaultRowHeight = (int)DpiAware.LogicalToDeviceUnits(25.0f); this.gridCalculations.DefaultColWidth = (int)DpiAware.LogicalToDeviceUnits(70.0f); this.gridCalculations.DefaultGridBorderStyle = GridBorderStyle.Solid; this.gridCalculations.ThemesEnabled = true; this.gridCalculations.MarkColHeader = true; this.gridCalculations.MarkRowHeader = true; this.gridCalculations.AlphaBlendSelectionColor = Color.Orange; this.gridCalculations.Properties.GridLineColor = Color.FromArgb(208, 215, 229); this.gridDisplay.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.StartPosition = FormStartPosition.CenterScreen; this.tabBarSplitterControl1.ThemesEnabled = true; this.gridDisplay.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(gridDisplay_PrepareViewStyleInfo); this.tabBarSplitterControl1.ActivePageChanged += new ControlEventHandler(tabBarSplitterControl1_ActivePageChanged); this.tabBarSplitterControl1.ShowVerticalScrollBar = false; }