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 圖元。

適用於

另請參閱