IDataItemContainer.DisplayIndex 属性

定义

实现时,获取在控件中所显示的数据项的位置。When implemented, gets the position of the data item as displayed in a control.

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

属性值

一个 Integer,表示在控件中所显示的数据项的位置。An Integer representing the position of the data item as displayed in a control.

示例

下面的代码示例演示了DisplayIndex属性的实现。The following code example demonstrates an implementation of the DisplayIndex property. 它是IDataItemContainer类概述主题中更大示例的一部分。It is part of a larger example in the IDataItemContainer class overview topic.

int IDataItemContainer.DisplayIndex
{
    get
    {
        return _itemIndex;
    }
}
ReadOnly Property DisplayIndex() As Integer Implements IDataItemContainer.DisplayIndex
    Get
        Return _itemIndex
    End Get
End Property

注解

在实现类 (如DataGridViewColumn) 的DisplayIndex情况下, 将根据显示的行中的行的索引来设置属性。In implementing classes such as DataGridViewColumn, the DisplayIndex property is set according to the index of the row among the displayed rows.

适用于

另请参阅