ListBox.ItemHeight 属性

定义

获取或设置 ListBox 中项的高度。

public:
 virtual property int ItemHeight { int get(); void set(int value); };
public virtual int ItemHeight { get; set; }
member this.ItemHeight : int with get, set
Public Overridable Property ItemHeight As Integer

属性值

Int32

控件中项的高度(以像素为单位)。

例外

ItemHeight 属性被设置为小于 0 或大于 255 像素。

注解

当属性 DrawMode 设置为 DrawMode.OwnerDrawFixed时,所有项的高度相同。 当属性 DrawMode 设置为 DrawMode.OwnerDrawVariable时,该 ItemHeight 属性指定添加到该 ListBox属性的每个项的高度。 由于所有者绘制列表中的每个项目可以具有不同的高度,因此可以使用该方法 GetItemHeight 获取特定项的高度 ListBox。 如果将 ItemHeight 属性 ListBox 用于具有可变高度项的属性,则此属性返回控件中第一项的高度。

项的最大高度 ListBox 为 255 像素。

适用于

另请参阅