winforms\Managed\System\WinForms\DataGridViewRowCollection.cs (198)
269if (this.DataGridView != null)
271this.DataGridView.OnRowUnshared(dataGridViewRow);
287dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
295if (this.DataGridView != null)
297this.DataGridView.OnRowUnshared(newDataGridViewRow);
325if (this.DataGridView.DataSource != null)
330if (this.DataGridView.NoDimensionChangeAllowed)
340Debug.Assert(this.DataGridView != null);
342if (this.DataGridView.Columns.Count == 0)
347if (this.DataGridView.RowTemplate.Cells.Count > this.DataGridView.Columns.Count)
352DataGridViewRow dataGridViewRow = this.DataGridView.RowTemplateClone;
353Debug.Assert(dataGridViewRow.Cells.Count == this.DataGridView.Columns.Count);
372if (this.DataGridView.NewRowIndex != -1)
374Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
375Debug.Assert(this.DataGridView.NewRowIndex == this.Count - 1);
382this.DataGridView.OnAddingRow(dataGridViewRow, rowState, true /*checkFrozenState*/); // will throw an exception if the addition is illegal
390dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
396dataGridViewRow.HeaderCell.DataGridViewInternal = this.DataGridView;
421Debug.Assert(this.DataGridView != null);
434if (this.DataGridView.VirtualMode)
439if (this.DataGridView.DataSource != null)
444if (this.DataGridView.NoDimensionChangeAllowed)
466if (this.DataGridView.Columns.Count == 0)
471if (this.DataGridView.DataSource != null)
476if (this.DataGridView.NoDimensionChangeAllowed)
488Debug.Assert(this.DataGridView != null);
495if (this.DataGridView.Columns.Count == 0)
500if (this.DataGridView.DataSource != null)
505if (this.DataGridView.NoDimensionChangeAllowed)
510if (this.DataGridView.RowTemplate.Cells.Count > this.DataGridView.Columns.Count)
515DataGridViewRow rowTemplate = this.DataGridView.RowTemplateClone;
516Debug.Assert(rowTemplate.Cells.Count == this.DataGridView.Columns.Count);
525dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
534if (this.DataGridView.NewRowIndex != -1)
536Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
537Debug.Assert(this.DataGridView.NewRowIndex == this.Count - 1);
548Debug.Assert(this.DataGridView != null);
558if (this.DataGridView.Columns.Count == 0)
562if (dataGridViewRow.Cells.Count > this.DataGridView.Columns.Count)
572if (this.DataGridView.NewRowIndex != -1)
574Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
575Debug.Assert(this.DataGridView.NewRowIndex == this.Count - 1);
581this.DataGridView.CompleteCellsCollection(dataGridViewRow);
582Debug.Assert(dataGridViewRow.Cells.Count == this.DataGridView.Columns.Count);
583this.DataGridView.OnAddingRow(dataGridViewRow, dataGridViewRow.State, true /*checkFrozenState*/); // will throw an exception if the addition is illegal
592dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
599dataGridViewRow.HeaderCell.DataGridViewInternal = this.DataGridView;
626if (this.DataGridView.DataSource != null)
631if (this.DataGridView.NoDimensionChangeAllowed)
641Debug.Assert(this.DataGridView != null);
643if (this.DataGridView.NewRowIndex != -1)
645Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
646Debug.Assert(this.DataGridView.NewRowIndex == this.Count - 1);
662Debug.Assert(this.DataGridView != null);
665this.DataGridView.OnAddingRow(rowTemplate, rowState, true /*checkFrozenState*/); // will throw an exception if the addition is illegal
692if (this.DataGridView.DataSource != null)
697if (this.DataGridView.NoDimensionChangeAllowed)
707if (this.DataGridView.NewRowIndex != -1)
709Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
710Debug.Assert(this.DataGridView.NewRowIndex == this.Count - 1);
742this.DataGridView.OnAddingRow(rowTemplate, rowTemplateState, true /*checkFrozenState*/); // Done once only, continue to check if this is OK - will throw an exception if the addition is illegal.
755this.DataGridView.OnAddedRow_PreNotification(index); // Only calling this once instead of 'count' times. Continue to check if this is OK.
759this.DataGridView.OnAddedRow_PostNotification(index - (count - 1) + i);
768this.DataGridView.OnAddedRow_PreNotification(index);
772this.DataGridView.OnAddingRow(rowTemplate2, rowTemplateState, true /*checkFrozenState*/); // done only once, continue to check if this is OK - will throw an exception if the addition is illegal
785this.DataGridView.OnAddedRow_PreNotification(index); // Only calling this once instead of 'count-1' times. Continue to check if this is OK.
794this.DataGridView.OnAddedRow_PreNotification(index);
800this.DataGridView.OnAddedRow_PostNotification(index - (count - 1) + i);
818Debug.Assert(this.DataGridView != null);
832dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
842this.DataGridView.OnAddingRow(dataGridViewRow, rowState, true /*checkFrozenState*/); // will throw an exception if the addition is illegal
863Debug.Assert(this.DataGridView != null);
865if (this.DataGridView.NoDimensionChangeAllowed)
870if (this.DataGridView.DataSource != null)
875if (this.DataGridView.NewRowIndex != -1)
877Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
878Debug.Assert(this.DataGridView.NewRowIndex == this.Count - 1);
883if (this.DataGridView.Columns.Count == 0)
891this.DataGridView.OnAddingRows(dataGridViewRows, true /*checkFrozenStates*/); // will throw an exception if the addition is illegal
895Debug.Assert(dataGridViewRow.Cells.Count == this.DataGridView.Columns.Count);
901dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
925this.DataGridView.OnAddedRows_PreNotification(dataGridViewRows);
927this.DataGridView.OnAddedRows_PostNotification(dataGridViewRows);
933if (this.DataGridView.NoDimensionChangeAllowed)
937if (this.DataGridView.DataSource != null)
939IBindingList list = this.DataGridView.DataConnection.List as IBindingList;
960this.DataGridView.OnClearingRows();
977this.DataGridView.Columns.Count != 0 &&
978this.DataGridView.AllowUserToAddRowsInternal &&
981this.DataGridView.AddNewRow(false);
1470Debug.Assert(this.DataGridView != null);
1484if (this.DataGridView.VirtualMode)
1489if (this.DataGridView.DataSource != null)
1494DataGridViewRow dataGridViewRow = this.DataGridView.RowTemplateClone;
1505if (this.DataGridView.DataSource != null)
1510if (this.DataGridView.NoDimensionChangeAllowed)
1521if (this.DataGridView.DataSource != null)
1536if (this.DataGridView.NoDimensionChangeAllowed)
1541if (this.DataGridView.Columns.Count == 0)
1546if (this.DataGridView.RowTemplate.Cells.Count > this.DataGridView.Columns.Count)
1551if (this.DataGridView.NewRowIndex != -1 && rowIndex == this.Count)
1554Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
1558DataGridViewRow rowTemplate = this.DataGridView.RowTemplateClone;
1559Debug.Assert(rowTemplate.Cells.Count == this.DataGridView.Columns.Count);
1568dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
1582Debug.Assert(this.DataGridView != null);
1598if (this.DataGridView.NewRowIndex != -1 && rowIndex == this.Count)
1601Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
1605if (this.DataGridView.Columns.Count == 0)
1610if (dataGridViewRow.Cells.Count > this.DataGridView.Columns.Count)
1625Debug.Assert(this.DataGridView != null);
1629Debug.Assert(!this.DataGridView.NoDimensionChangeAllowed);
1630Debug.Assert(this.DataGridView.NewRowIndex == -1 || rowIndex != this.Count);
1637if (this.DataGridView.Columns.Count == 0)
1641if (dataGridViewRow.Cells.Count > this.DataGridView.Columns.Count)
1646this.DataGridView.CompleteCellsCollection(dataGridViewRow);
1647Debug.Assert(dataGridViewRow.Cells.Count == this.DataGridView.Columns.Count);
1648this.DataGridView.OnInsertingRow(rowIndex, dataGridViewRow, dataGridViewRow.State, ref newCurrentCell, true, 1, force); // will throw an exception if the insertion is illegal
1657dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
1664dataGridViewRow.HeaderCell.DataGridViewInternal = this.DataGridView;
1696if (this.DataGridView.DataSource != null)
1701if (this.DataGridView.NoDimensionChangeAllowed)
1711Debug.Assert(this.DataGridView != null);
1728if (this.DataGridView.NewRowIndex != -1 && indexDestination == this.Count)
1731Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
1747this.DataGridView.OnInsertingRow(indexDestination, rowTemplate, rowTemplateState, ref newCurrentCell, true, count, false /*force*/);
1759this.DataGridView.OnInsertedRow_PreNotification(indexDestination, count);
1763this.DataGridView.OnInsertedRow_PostNotification(indexDestination + i, newCurrentCell, i == count - 1);
1768this.DataGridView.OnInsertingRow(indexDestination, rowTemplate, rowTemplateState, ref newCurrentCell, true, 1, false /*force*/); // will throw an exception if the insertion is illegal
1786this.DataGridView.OnInsertedRow_PreNotification(indexDestination, 1);
1791this.DataGridView.OnInsertingRow(indexDestination + 1, rowTemplate2, rowTemplateState, ref newCurrentCell, false, count-1, false /*force*/);
1803this.DataGridView.OnInsertedRow_PreNotification(indexDestination+1, count-1);
1814this.DataGridView.OnInsertedRow_PreNotification(indexDestination + i, 1);
1820this.DataGridView.OnInsertedRow_PostNotification(indexDestination + i, newCurrentCell, i == count - 1);
1836Debug.Assert(this.DataGridView != null);
1846dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
1856this.DataGridView.OnInsertingRow(indexDestination, dataGridViewRow, rowState, ref newCurrentCell, firstInsertion, 1, false /*force*/); // will throw an exception if the insertion is illegal
1875Debug.Assert(this.DataGridView != null);
1893if (this.DataGridView.NoDimensionChangeAllowed)
1898if (this.DataGridView.NewRowIndex != -1 && rowIndex == this.Count)
1901Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
1905if (this.DataGridView.DataSource != null)
1910if (this.DataGridView.Columns.Count == 0)
1918this.DataGridView.OnInsertingRows(rowIndex, dataGridViewRows, ref newCurrentCell); // will throw an exception if the insertion is illegal
1923Debug.Assert(dataGridViewRow.Cells.Count == this.DataGridView.Columns.Count);
1931dataGridViewCell.OwningColumnInternal = this.DataGridView.Columns[columnIndex];
1938dataGridViewRow.HeaderCell.DataGridViewInternal = this.DataGridView;
1958this.DataGridView.OnInsertedRows_PreNotification(rowIndex, dataGridViewRows);
1960this.DataGridView.OnInsertedRows_PostNotification(dataGridViewRows, newCurrentCell);
2090Debug.Assert(this.DataGridView != null);
2107int firstDisplayedRowIndex = this.DataGridView.FirstDisplayedRowIndex;
2115this.DataGridView.OnInsertedRow_PreNotification(rowIndex, 1);
2121useRowShortcut = this.DataGridView.FirstDisplayedScrollingRowIndex == -1 &&
2122GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex, this.DataGridView.LayoutInfo.Data.Height);
2124else if (this.DataGridView.FirstDisplayedScrollingRowIndex != -1 &&
2125rowIndex > this.DataGridView.FirstDisplayedScrollingRowIndex)
2127useRowShortcut = GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex, this.DataGridView.LayoutInfo.Data.Height + this.DataGridView.VerticalScrollingOffset) &&
2128firstDisplayedRowHeight <= this.DataGridView.LayoutInfo.Data.Height;
2134this.DataGridView.OnAddedRow_PreNotification(rowIndex);
2137int displayedRowsHeightBeforeAddition = GetRowsHeight(DataGridViewElementStates.Visible) - this.DataGridView.VerticalScrollingOffset - dataGridViewRow.GetHeight(rowIndex);
2139useRowShortcut = this.DataGridView.LayoutInfo.Data.Height < displayedRowsHeightBeforeAddition &&
2140firstDisplayedRowHeight <= this.DataGridView.LayoutInfo.Data.Height;
2159this.DataGridView.OnRemovedRow_PreNotification(rowIndex);
2165useRowShortcut = this.DataGridView.FirstDisplayedScrollingRowIndex == -1 &&
2166GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex, this.DataGridView.LayoutInfo.Data.Height + SystemInformation.HorizontalScrollBarHeight);
2168else if (this.DataGridView.FirstDisplayedScrollingRowIndex != -1 &&
2169rowIndex > this.DataGridView.FirstDisplayedScrollingRowIndex)
2172int firstDisplayedRowIndex = this.DataGridView.FirstDisplayedRowIndex;
2177useRowShortcut = GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex, this.DataGridView.LayoutInfo.Data.Height + this.DataGridView.VerticalScrollingOffset + SystemInformation.HorizontalScrollBarHeight) &&
2178firstDisplayedRowHeight <= this.DataGridView.LayoutInfo.Data.Height;
2202this.DataGridView.ResetUIState(useRowShortcut, computeVisibleRows);
2214Debug.Assert(this.DataGridView != null);
2217this.DataGridView.OnRowsRemovedInternal(rowIndex, rowCount);
2221this.DataGridView.OnRowsAddedInternal(rowIndex, rowCount);
2233this.DataGridView.OnInsertedRow_PostNotification(rowIndex, newCurrentCell, true);
2237this.DataGridView.OnAddedRow_PostNotification(rowIndex);
2244this.DataGridView.OnRemovedRow_PostNotification(dataGridViewRow, newCurrentCell);
2252this.DataGridView.OnClearedRows();
2258this.DataGridView.OnRowCollectionChanged_PostNotification(recreateNewRow, newCurrentCell.X == -1, cca, dataGridViewRow, rowIndex);
2272if (dataGridViewRow.DataGridView != this.DataGridView)
2295if (this.DataGridView.NewRowIndex == index)
2297Debug.Assert(this.DataGridView.AllowUserToAddRowsInternal);
2301if (this.DataGridView.NoDimensionChangeAllowed)
2306if (this.DataGridView.DataSource != null)
2308IBindingList list = this.DataGridView.DataConnection.List as IBindingList;
2329Debug.Assert(this.DataGridView != null);
2330Debug.Assert(!this.DataGridView.NoDimensionChangeAllowed);
2341Debug.Assert(this.DataGridView != null);
2342this.DataGridView.OnRemovingRow(index, out newCurrentCell, force);
2486this.DataGridView.SwapSortedRows(rowIndex1, rowIndex2);
2500if (this.DataGridView.VirtualMode)
2503int columnCount = this.DataGridView.Columns.Count;
2784this.dataGridView = dataGridViewRows.DataGridView;