ListBox.GetItemRectangle(Int32) 方法

定義

傳回 ListBox 中項目的週框 (Bounding Rectangle)。

public:
 System::Drawing::Rectangle GetItemRectangle(int index);
public System.Drawing.Rectangle GetItemRectangle (int index);
member this.GetItemRectangle : int -> System.Drawing.Rectangle
Public Function GetItemRectangle (index As Integer) As Rectangle

參數

index
Int32

項目之以零起始的索引,您將要傳回該項目的週框。

傳回

Rectangle

Rectangle,表示特定項目的週框。

例外狀況

index 參數小於零,或者大於等於 Count 類別的 ListBox.ObjectCollection 屬性值。

備註

如果看不到參數中指定的 index 專案,這個方法所傳回的矩形將會超出控制項的可見部分。 您可以使用這個方法來判斷專案在清單中的大小和位置。 若要取得專案的高度,特別是可變高度擁有者繪製的清單專案,您可以使用 GetItemHeight 方法。

適用於