DataGridViewRowPostPaintEventArgs.InheritedRowStyle 속성

정의

현재 DataGridViewRow에 적용된 셀 스타일을 가져옵니다.

public:
 property System::Windows::Forms::DataGridViewCellStyle ^ InheritedRowStyle { System::Windows::Forms::DataGridViewCellStyle ^ get(); };
public System.Windows.Forms.DataGridViewCellStyle InheritedRowStyle { get; }
member this.InheritedRowStyle : System.Windows.Forms.DataGridViewCellStyle
Public ReadOnly Property InheritedRowStyle As DataGridViewCellStyle

속성 값

현재 DataGridViewCellStyle에 적용된 셀 스타일을 포함하는 DataGridViewRow입니다.

예제

다음 코드 예제를 사용 InheritedRowStyle 하는 방법에 설명 합니다 콘텐츠를 그리는 데 사용할 색을 결정 하는 합니다. 변수 는 e형식 DataGridViewRowPostPaintEventArgs입니다. 이 코드 예제는에서 제공 하는 더 큰 예제의 일부입니다 방법: Windows Forms DataGridView 컨트롤에서 행 모양 사용자 지정합니다.

// Determine the foreground color.
if ((e.State & DataGridViewElementStates.Selected) ==
    DataGridViewElementStates.Selected)
{
    forebrush = new SolidBrush(e.InheritedRowStyle.SelectionForeColor);
}
else
{
    forebrush = new SolidBrush(e.InheritedRowStyle.ForeColor);
}
' Determine the foreground color.
If (e.State And DataGridViewElementStates.Selected) = _
    DataGridViewElementStates.Selected Then

    forebrush = New SolidBrush(e.InheritedRowStyle.SelectionForeColor)
Else
    forebrush = New SolidBrush(e.InheritedRowStyle.ForeColor)
End If

설명

속성은 InheritedRowStyle 현재 행의 InheritedStyle 속성과 동일한 값을 포함합니다. 에서 에 직접 액세스하면 DataGridViewRow 성능에 DataGridView 영향을 줄 수 있습니다. 이벤트에서 를 RowPostPaint 사용하여 InheritedRowStyle 행의 공유를 해제하지 않고 최적의 성능을 유지합니다.

InheritedRowStyle 속성은 읽기 전용입니다. 속성을 통해 InheritedRowStyle 검색된 의 DataGridViewCellStyle 속성을 설정할 수 있지만 새 설정은 영향을 주지 않습니다.

적용 대상

추가 정보