ComboBox.ItemHeight 屬性

定義

取得或設定下拉式方塊中的項目高度。Gets or sets the height of an item in the combo box.

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

屬性值

下拉式方塊的項目高度 (單位為像素)。The height, in pixels, of an item in the combo box.

例外狀況

項目高度值小於零。The item height value is less than zero.

備註

當 [DrawMode] 屬性設定為 [OwnerDrawFixed] 時,所有專案都具有相同的高度。When the DrawMode property is set to OwnerDrawFixed, all items have the same height. DrawMode 屬性設定為 OwnerDrawVariable時,ItemHeight 屬性會指定加入至 ComboBox之每個專案的高度。When the DrawMode property is set to OwnerDrawVariable, the ItemHeight property specifies the height of each item added to the ComboBox. 因為主控描繪清單中的每個專案都可以有不同的高度,所以您可以使用 GetItemHeight 方法來取得 ComboBox中特定專案的高度。Because each item in an owner-drawn list can have a different height, you can use the GetItemHeight method to get the height of a specific item in the ComboBox. 如果您在具有變數高度專案的 ComboBox 上使用 ItemHeight 屬性,這個屬性會傳回控制項中第一個專案的高度。If you use the ItemHeight property on a ComboBox with items of variable height, this property returns the height of the first item in the control.

如需針對主控描繪清單中的專案指定高度的詳細資訊,請參閱 MeasureItem 事件。For more information about specifying the height for items in an owner-drawn list, see MeasureItem event.

適用於