当前位置: 首页>>代码示例>>C#>>正文


C# DataGridViewRow.SetIndex方法代码示例

本文整理汇总了C#中System.Windows.Forms.DataGridViewRow.SetIndex方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewRow.SetIndex方法的具体用法?C# DataGridViewRow.SetIndex怎么用?C# DataGridViewRow.SetIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.DataGridViewRow的用法示例。


在下文中一共展示了DataGridViewRow.SetIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Insert

		// FIXME: Do *not* allow insertation *after* the editing row!
		public virtual void Insert (int rowIndex, DataGridViewRow dataGridViewRow)
		{
			dataGridViewRow.SetIndex (rowIndex);
			dataGridViewRow.SetDataGridView (dataGridView);
			CompleteRowCells (dataGridViewRow);
			list.Insert (rowIndex, dataGridViewRow);
			ReIndex ();
			OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, dataGridViewRow));
			if (raiseEvent)
				DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (rowIndex, 1));
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:DataGridViewRowCollection.cs

示例2: AddCore

		private int AddCore (DataGridViewRow dataGridViewRow, bool sharable)
		{
			if (dataGridView.Columns.Count == 0)
				throw new InvalidOperationException ("DataGridView has no columns.");
			
			int result;
			
			dataGridViewRow.SetDataGridView (dataGridView);

			// 
			// Add the row just before the editing row (if there is an editing row).
			// 
			int editing_index = -1;
			if (DataGridView != null && DataGridView.EditingRow != null && DataGridView.EditingRow != dataGridViewRow) {
				editing_index = list.Count - 1; // always the last row
				DataGridView.EditingRow.SetIndex (list.Count);
			}
			
			if (editing_index >= 0) {
				list.Insert (editing_index, dataGridViewRow);
				result = editing_index;
			} else {
				result = list.Add (dataGridViewRow);
			}
			
			if (sharable && CanBeShared (dataGridViewRow)) {
				dataGridViewRow.SetIndex (-1);
			} else {
				dataGridViewRow.SetIndex (result);
			}

			CompleteRowCells (dataGridViewRow);
			for (int i = 0; i < dataGridViewRow.Cells.Count; i++) {
				dataGridViewRow.Cells [i].SetOwningColumn (dataGridView.Columns [i]);
			}

			if (raiseEvent) {
				OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, dataGridViewRow));
				DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (result, 1));
			}

			return result;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:43,代码来源:DataGridViewRowCollection.cs


注:本文中的System.Windows.Forms.DataGridViewRow.SetIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。