DataGridViewCell.GetInheritedContextMenuStrip(Int32) 메서드

정의

현재 셀의 상속된 바로 가기 메뉴를 가져옵니다.

public:
 virtual System::Windows::Forms::ContextMenuStrip ^ GetInheritedContextMenuStrip(int rowIndex);
public virtual System.Windows.Forms.ContextMenuStrip GetInheritedContextMenuStrip (int rowIndex);
public virtual System.Windows.Forms.ContextMenuStrip? GetInheritedContextMenuStrip (int rowIndex);
abstract member GetInheritedContextMenuStrip : int -> System.Windows.Forms.ContextMenuStrip
override this.GetInheritedContextMenuStrip : int -> System.Windows.Forms.ContextMenuStrip
Public Overridable Function GetInheritedContextMenuStrip (rowIndex As Integer) As ContextMenuStrip

매개 변수

rowIndex
Int32

현재 셀의 행 인덱스입니다.

반환

부모 ContextMenuStrip, DataGridView 또는 DataGridViewRowDataGridViewColumn이 할당되어 있으면 ContextMenuStrip이고, 그렇지 않으면 null입니다.

예외

셀의 DataGridView 속성 값이 null이 아니고 지정된 rowIndex가 0보다 작거나 열의 행 수 - 1보다 큰 경우

ColumnIndex가 0보다 작아 셀이 행 머리글 셀임을 나타내는 경우

설명

셀에 연결된 ContextMenuStrip가 없는 경우 다음 우선 순위를 사용하여 부모로부터 상속됩니다.

  1. 이 셀의 ContextMenuStrip

  2. 소유 행의 DataGridViewRow.ContextMenuStrip

  3. 소유 열의 DataGridViewColumn.ContextMenuStrip

  4. 부모 테이블의 System.Windows.Forms.ContextMenuStrip

바로 가기 메뉴는 일반적으로 메서드 또는 소멸자에서 수명을 지정하는 Windows 네이티브 리소스를 Dispose Microsoft.

GetInheritedContextMenuStrip 검색하는 데 사용한 행 인덱스 메서드를 전달합니다 DataGridViewCell. 매개 변수에 RowIndex 속성을 rowIndex 사용하지 마세요. 행이 공유 RowIndex 되는 경우 는 -1이며 에 유효한 값 rowIndex이 아닙니다.

적용 대상

추가 정보