Aracılığıyla paylaş


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, etüründedir DataGridViewRowPostPaintEventArgs. Bu kod örneği, Nasıl yapılır: Windows Forms DataGridView Denetiminde Satırların Görünümünü Özelleştirme bölümünde 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 dondurulup, salt okunur mu yoksa seçili mi olduğunu belirlemek için kullanılabilir.

Şunlara uygulanır

Ayrıca bkz.