private void assertColumns( AnalyticalGrid dgv, string[] row ) { if ( dgv.Columns.Count == 0 ) { int i = 0; foreach ( string s in row ) { dgv.Columns.Add( "col" + i, s ); dgv.Columns[i].DefaultCellStyle.BackColor = dgv.BackgroundColor; i++; } } }
private void spill( AnalyticalGrid dgv, int side ) { object obj = dgv.CurrentCell.Value; string txt = obj != null ? obj.ToString() : ""; bool reset = false; int src = dgv.CurrentCell.ColumnIndex; int dst = src + side; for ( int i = dgv.CurrentCell.RowIndex; i < dgv.Rows.Count; i++ ) { obj = dgv.Rows[i].Cells[src].Value; string stopper = obj != null ? obj.ToString().Trim() : ""; if ( string.IsNullOrEmpty( stopper ) ) { reset = true; txt = string.Empty; } else { if ( reset ) { reset = false; txt = stopper; } } dgv.Rows[i].Cells[dst].Value = txt; } }
private int[] getSelectedColumnIndexes( AnalyticalGrid dgv ) { List<int> cols = new List<int>(); foreach ( DataGridViewCell cell in dgv.SelectedCells ) { cols.Add( cell.ColumnIndex ); } cols.Sort(); return cols.ToArray(); }
private void excludeValue( AnalyticalGrid dgv ) { var toDel = new List<DataGridViewRow>(); int index = dgv.CurrentCell.ColumnIndex; object obj = dgv.CurrentCell.Value; string txt = obj != null ? obj.ToString() : ""; foreach ( DataGridViewRow row in dgv.Rows ) { obj = row.Cells[index].Value; string current = obj != null ? obj.ToString() : ""; if ( txt.Equals( current ) ) { toDel.Add( row ); } } toDel.ForEach( en => dgv.Rows.Remove( en ) ); }
private void doLoad( AnalyticalGrid useGrid ) { if ( od1.ShowDialog() == System.Windows.Forms.DialogResult.OK ) { workGrid = useGrid; workGrid.Rows.Clear(); workGrid.Columns.Clear(); this.Enabled = false; Application.DoEvents(); CSVParser parser = new CSVParser(); parser.OnRowComplete += new CSVParser.IRowComplete( parser_OnRowComplete ); try { parserConfig.FileName = od1.FileName; parser.Parse( parserConfig ); } finally { parser.OnRowComplete -= parser_OnRowComplete; this.Enabled = true; } } }
private void deleteColumns( AnalyticalGrid dgv ) { List<DataGridViewColumn> cols = new List<DataGridViewColumn>(); foreach ( DataGridViewCell cell in dgv.SelectedCells ) { cols.Add(dgv.Columns[cell.ColumnIndex]); } foreach ( var col in cols ) { dgv.Columns.Remove( col ); } }
private void createColumn( AnalyticalGrid dgv ) { if ( dgv.CurrentCell == null ) { return; } DataGridViewColumn newColumn = new DataGridViewTextBoxColumn(); dgv.Columns.Insert( dgv.CurrentCell.ColumnIndex, newColumn ); }