DataGridViewRowPostPaintEventArgs.IsFirstDisplayedRow 属性

定义

获取或设置一个指示当前行是否为 DataGridView 中显示的第一个行的值。

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

属性值

如果所绘制的行是 DataGridView 中当前显示的第一行,则为 true;否则为 false

示例

下面的代码示例演示了此成员的用法。 在此示例中,事件处理程序报告事件的发生情况 DataGridView.RowPostPaint 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。

若要运行示例代码,请将其粘贴到包含名为 DataGridView1的类型的DataGridView实例的项目中。 然后,确保事件处理程序与 DataGridView.RowPostPaint 事件相关联。

private void DataGridView1_RowPostPaint(Object sender, DataGridViewRowPostPaintEventArgs 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}", "RowBounds", e.RowBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowPostPaint Event" );
}
Private Sub DataGridView1_RowPostPaint(sender as Object, e as DataGridViewRowPostPaintEventArgs) _ 
     Handles DataGridView1.RowPostPaint

    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}", "RowBounds", e.RowBounds)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "State", e.State)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RowPostPaint Event")

End Sub

适用于

另请参阅