DataGridViewRowPrePaintEventArgs.IsLastVisibleRow Propriété

Définition

Obtient une valeur indiquant si la ligne active est la dernière ligne visible dans DataGridView.

public:
 property bool IsLastVisibleRow { bool get(); };
public bool IsLastVisibleRow { get; }
member this.IsLastVisibleRow : bool
Public ReadOnly Property IsLastVisibleRow As Boolean

Valeur de propriété

true si la ligne en cours de peinture est la dernière ligne dans DataGridView dont la propriété Visible a la valeur true ; sinon, false.

Exemples

L’exemple de code suivant illustre l’utilisation de ce membre. Dans l’exemple, un gestionnaire d’événements signale l’occurrence de l’événement DataGridView.RowPrePaint . Ce rapport vous aide à savoir quand l’événement se produit et peut vous aider à déboguer.

Pour exécuter l’exemple de code, collez-le dans un projet qui contient un instance de type DataGridView nommé DataGridView1. Vérifiez ensuite que le gestionnaire d’événements est associé à l’événement DataGridView.RowPrePaint .

private void DataGridView1_RowPrePaint(Object sender, DataGridViewRowPrePaintEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ClipBounds", e.ClipBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "InheritedRowStyle", e.InheritedRowStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsFirstDisplayedRow", e.IsFirstDisplayedRow );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsLastVisibleRow", e.IsLastVisibleRow );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "PaintParts", e.PaintParts );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowBounds", e.RowBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowPrePaint Event" );
}
Private Sub DataGridView1_RowPrePaint(sender as Object, e as DataGridViewRowPrePaintEventArgs) _ 
     Handles DataGridView1.RowPrePaint

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ClipBounds", e.ClipBounds)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "InheritedRowStyle", e.InheritedRowStyle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IsFirstDisplayedRow", e.IsFirstDisplayedRow)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IsLastVisibleRow", e.IsLastVisibleRow)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "PaintParts", e.PaintParts)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowBounds", e.RowBounds)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "State", e.State)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Handled", e.Handled)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RowPrePaint Event")

End Sub

S’applique à

Voir aussi