DataGridViewRowCollection.InsertCopies(Int32, Int32, Int32) 메서드

정의

컬렉션에서 지정된 위치에 행을 삽입합니다.

public:
 virtual void InsertCopies(int indexSource, int indexDestination, int count);
public virtual void InsertCopies (int indexSource, int indexDestination, int count);
abstract member InsertCopies : int * int * int -> unit
override this.InsertCopies : int * int * int -> unit
Public Overridable Sub InsertCopies (indexSource As Integer, indexDestination As Integer, count As Integer)

매개 변수

indexSource
Int32

새 행의 기반이 되는 DataGridViewRow 의 인덱스입니다.

indexDestination
Int32

행을 삽입할 위치입니다.

count
Int32

DataGridViewRow 에 추가할 DataGridViewRowCollection개체의 수입니다.

예외

indexSource 가 0보다 작거나 컬렉션의 항목 수에서 1을 뺀 수보다 큽니다.

또는

indexDestination 가 0보다 작거나 컬렉션의 행 수보다 큽니다.

또는

count 가 1보다 작습니다.

연결된 DataGridView 컨트롤이 일시적으로 새 행이 추가되지 않도록 하는 다음 작업 중 하나를 수행합니다.

  • 컨트롤의 모든 셀을 선택합니다.

  • 선택 영역 지우기.

또는

이 메서드는 다음 DataGridView 이벤트 중 하나의 처리기에서 호출됩니다.

또는

indexDestination 이 컬렉션의 행 수와 같고 AllowUserToAddRowstrue입니다.

또는

이 작업에서는 고정되지 않은 행 뒤에 고정된 행을 삽입하거나 고정된 행 앞에 고정되지 않은 행을 삽입합니다.

설명

InheritedStyleDataGridViewRow 개체의 속성은 에 indexSource배치된 의 DataGridViewRow 와 동일한 값을 InheritedStyle 입니다. 가능한 경우 메서드는 InsertCopies 공유 행을 에 DataGridViewRowCollection추가합니다. 그렇지 않으면 새 행이 공유되지 않습니다. 자세한 내용은 Windows Forms DataGridView 컨트롤의 크기를 조정하는 최선의 방법을 참조하세요.

컨트롤의 행은 새 행이 추가될 때 자동으로 정렬되지 않습니다. 새 행을 올바른 위치로 정렬하려면 이벤트 처리기에서 메서드를 DataGridView.RowsAdded 호출 DataGridView.Sort 합니다. 사용자가 셀을 DataGridView.Sort 수정할 때 이벤트 처리기에서 CellValueChanged 메서드를 호출하여 행을 정렬할 수도 있습니다.

적용 대상

추가 정보