Share via


DataGridViewRowPostPaintEventArgs.State Özellik

Tanım

Geçerli DataGridViewRowdurumunu alır.

public:
 property System::Windows::Forms::DataGridViewElementStates State { System::Windows::Forms::DataGridViewElementStates get(); };
public System.Windows.Forms.DataGridViewElementStates State { get; }
member this.State : System.Windows.Forms.DataGridViewElementStates
Public ReadOnly Property State As DataGridViewElementStates

Özellik Değeri

Satırın DataGridViewElementStates durumunu belirten bit düzeyinde değerler birleşimi.

Örnekler

Aşağıdaki kod örneği, geçerli satırın State seçili olup olmadığını belirlemek için özelliğinin nasıl kullanılacağını gösterir. değişkeni e, türündedir DataGridViewRowPostPaintEventArgs. Bu kod örneği, Nasıl yapılır: Windows Forms DataGridView Denetimindeki Satırların Görünümünü Özelleştirme konusunda sağlanan daha büyük bir örneğin parçasıdır.

// 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

Açıklamalar

Bu özellik, satırın diğer durumlar arasında dondurulmuş, salt okunur veya seçili olup olmadığını belirlemek için kullanılabilir.

Şunlara uygulanır

Ayrıca bkz.