private static void UpdateCell(GridDataBoundGrid grid, object modifiedCellValue, int row, int col) { if (grid[row, col].CellValue != modifiedCellValue) { grid[row, col].CellValue = modifiedCellValue; } }
private void DoubleBuffering(GridDataBoundGrid dbg, bool setting) { Type dbgType = dbg.GetType(); PropertyInfo pi = dbgType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); pi.SetValue(dbg, setting, null); }
private void InsertRowNew() { int index = tabControl1.SelectedIndex; GridDataBoundGrid dbg = tabControl1.SelectedTab.Controls.OfType <GridDataBoundGrid>().First(); ds.Tables[index.ToString()].Rows.Add(""); dbg.Refresh(); }
/*public void Init() { * if(Plugins != null) { * Plugins.ForEach(plugin => plugin.Action()); * } * }*/ public void GetPluginByTargetFramework(string framework, GridDataBoundGrid dbg) { List <IPlugin> frameworkPlugs = new List <IPlugin>(); frameworkPlugs = Plugins.Where(p => p.TargetFramework == framework).ToList(); frameworkPlugs.ForEach(p => { p.Action(dbg); }); }
private static void UpdateRange(GridRangeInfo selectedRange, GridDataBoundGrid grid, object modifiedCellValue) { for (var row = selectedRange.Top; row <= selectedRange.Bottom; row++) { for (var col = selectedRange.Left; col <= selectedRange.Right; col++) { UpdateCell(grid, modifiedCellValue, row, col); } } }
private void InsertRowBefore() { int tabCIndex = tabControl1.SelectedIndex; GridDataBoundGrid dbg = tabControl1.SelectedTab.Controls.OfType <GridDataBoundGrid>().First(); DataRow dr; dr = ds.Tables[tabCIndex.ToString()].NewRow(); int index = dbg.CurrentCell.RowIndex - 1; ds.Tables[tabCIndex.ToString()].Rows.InsertAt(dr, index); }
private void HandleFilter(string filterState, string queryState, string queryString) { if (filterState == "Row") { if (queryState == "Like") { GridDataBoundGrid dbg = tabControl1.SelectedTab.Controls.OfType <GridDataBoundGrid>().First(); DataView dv = ((DataTable)dbg.DataSource).DefaultView; dv.RowFilter = queryString; dbg.Refresh(); } } }
private void OnColumnHeaderMouseClick(object sender, MouseEventArgs e) { int row, col; GridDataBoundGrid dbg = sender as GridDataBoundGrid; if (dbg.PointToRowCol(new Point(e.X, e.Y), out row, out col)) { if (dbg.Model[row, (col - 1)].CellType == "ColumnHeaderCell") { int tableIndex = tabControl1.SelectedIndex; EditHeader eh = new EditHeader(this.UpdateHeader); eh.TextBox1.Text = ds.Tables[tableIndex.ToString()].Columns[(col - 1)].ToString(); eh.TextBox2.Text = (col - 1).ToString(); eh.Show(); } } }
private void OpenCSVFile() { CheckForIllegalCrossThreadCalls = false; using (TextFieldParser csvParser = new TextFieldParser(path)) { csvParser.TextFieldType = FieldType.Delimited; csvParser.SetDelimiters(","); int index = this.tabControl1.SelectedIndex; bool firstLine = true; while (!csvParser.EndOfData) { //proccessing string[] fields = csvParser.ReadFields(); if (firstLine) { foreach (var val in fields) { ds.Tables[index.ToString()].Columns.Add(val); } firstLine = false; continue; } //get row data ds.Tables[index.ToString()].Rows.Add(fields); } //Get gridview GridDataBoundGrid dbg = tabControl1.SelectedTab.Controls.OfType <GridDataBoundGrid>().First(); //Attach event handler dbg.MouseDown += (s, e) => this.OnColumnHeaderMouseClick(s, e); //Bind data source dbg.DataSource = ds.Tables[index.ToString()]; } TabExtraInfo tabInfo; tabInfo = tabMetadataList.ElementAt(tabControl1.SelectedIndex); tabInfo.SetAssociatedFileName(tabControl1.SelectedTab.Text); tabInfo.SetHasUnsavedChanges(false); }
private void NewWindow() { TabPage tb = new TabPage(); GridDataBoundGrid dbg = new GridDataBoundGrid(); InitGrid(dbg); loader.GetPluginByTargetFramework("GridDataBoundGrid", dbg); //GridCardView card = new GridCardView(); //card.CaptionField = "ProductName"; //card.WireGrid(dbg); DataTable dt = new DataTable(); tb.Text = "New"; tb.Controls.Add(dbg); tabControl1.TabPages.Add(tb); tabControl1.SelectedTab = tb; }
public void InitGrid(GridDataBoundGrid dbg) { #region DataGridView Contructing dbg.Dock = DockStyle.Fill; dbg.ExcelLikeSelectionFrame = true; dbg.ExcelLikeCurrentCell = true; dbg.Model.Options.SelectionBorderBrush = new SolidBrush(Color.DarkGreen); dbg.Model.Options.SelectionBorderThickness = 4; dbg.ListBoxSelectionMode = SelectionMode.None; dbg.ShowRowHeaders = false; dbg.ThemesEnabled = true; dbg.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; DoubleBuffering(dbg, true); dbg.ShowColumnHeaders = true; dbg.AllowResizeToFit = true; dbg.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header"; dbg.Model.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(Model_QueryCellInfo); #endregion }
void IPlugin.Action(GridDataBoundGrid dbg) { dbg.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.SystemTheme; }
public BudgetGridPanel(GridDataBoundGrid datagrid) : this(datagrid.Size, datagrid.Location) { }