DataGridViewRowHeightInfoPushedEventArgs.RowIndex Свойство

Определение

Возвращает индекс строки, относительно которой произошло событие.

public:
 property int RowIndex { int get(); };
public int RowIndex { get; }
member this.RowIndex : int
Public ReadOnly Property RowIndex As Integer

Значение свойства

Начинающийся с нуля индекс строки.

Примеры

В следующем примере кода показано использование этого элемента. В этом примере обработчик событий сообщает о возникновении DataGridView.RowHeightInfoPushed события. Этот отчет поможет вам узнать, когда происходит событие, и может помочь в отладке. Чтобы сообщить о нескольких событиях или о событиях, которые происходят часто, рекомендуется заменить MessageBox.ShowConsole.WriteLine сообщение на или добавить его в многостроочный TextBox.

Чтобы выполнить пример кода, вставьте его в проект, содержащий экземпляр типа DataGridView с именем DataGridView1. Затем убедитесь, что обработчик событий связан с событием DataGridView.RowHeightInfoPushed .

private void DataGridView1_RowHeightInfoPushed(Object sender, DataGridViewRowHeightInfoPushedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Height", e.Height );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "MinimumHeight", e.MinimumHeight );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowHeightInfoPushed Event" );
}
Private Sub DataGridView1_RowHeightInfoPushed(sender as Object, e as DataGridViewRowHeightInfoPushedEventArgs) _ 
     Handles DataGridView1.RowHeightInfoPushed

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Height", e.Height)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "MinimumHeight", e.MinimumHeight)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Handled", e.Handled)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RowHeightInfoPushed Event")

End Sub

Применяется к

См. также раздел