ListBox.GetItemHeight(Int32) 方法

定义

返回 ListBox 中某项的高度。Returns the height of an item in the ListBox.

public:
 int GetItemHeight(int index);
public int GetItemHeight (int index);
member this.GetItemHeight : int -> int
Public Function GetItemHeight (index As Integer) As Integer

参数

index
Int32

要返回其高度的项的从零开始的索引。The zero-based index of the item to return the height for.

返回

指定的项的高度,以像素为单位。The height, in pixels, of the specified item.

异常

指定的 index 参数值小于零或大于项的计数。The specified value of the index parameter is less than zero or greater than the item count.

注解

如果 DrawMode 属性未设置为 DrawMode.OwnerDrawVariable,则将忽略 index 参数的值,因为标准 ListBox 中的所有项都具有相同的大小。If the DrawMode property is not set to DrawMode.OwnerDrawVariable, the value of the index parameter is ignored because all items in a standard ListBox are the same size. 当使用所有者描述的 ListBox 确定 ListBox内任何项的大小时,可以使用此属性。You can use this property when you are using an owner-drawn ListBox to determine the size of any item within the ListBox.

适用于