ListView.GetItemRect Method

Definition

在控件中检索项的边框。Retrieves the bounding rectangle for an item within the control.

Overloads

GetItemRect(Int32, ItemBoundsPortion)

在列表视图控件中检索指定项的边框的指定部分。Retrieves the specified portion of the bounding rectangle for a specific item within the list view control.

GetItemRect(Int32)

在列表视图控件中检索特定项的边框。Retrieves the bounding rectangle for a specific item within the list view control.

GetItemRect(Int32, ItemBoundsPortion)

在列表视图控件中检索指定项的边框的指定部分。Retrieves the specified portion of the bounding rectangle for a specific item within the list view control.

public:
 System::Drawing::Rectangle GetItemRect(int index, System::Windows::Forms::ItemBoundsPortion portion);
public System.Drawing.Rectangle GetItemRect (int index, System.Windows.Forms.ItemBoundsPortion portion);
member this.GetItemRect : int * System.Windows.Forms.ItemBoundsPortion -> System.Drawing.Rectangle
Public Function GetItemRect (index As Integer, portion As ItemBoundsPortion) As Rectangle

Parameters

index
Int32

位于要返回其边框的 ListView.ListViewItemCollection 内的项的从零开始的索引。The zero-based index of the item within the ListView.ListViewItemCollection whose bounding rectangle you want to return.

portion
ItemBoundsPortion

ItemBoundsPortion 值之一,表示要为其检索边框的 ListViewItem 的一部分。One of the ItemBoundsPortion values that represents a portion of the ListViewItem for which to retrieve the bounding rectangle.

Returns

Rectangle

Rectangle,表示指定 ListViewItem 的指定部分的边框。A Rectangle that represents the bounding rectangle for the specified portion of the specified ListViewItem.

Remarks

此版本的 GetItemRect 方法返回的边框仅表示 portion 参数中指定的项的部分。The bounding rectangle returned by this version of the GetItemRect method represents only the section of the item specified in the portion parameter. 若要返回整个项的边框,请使用 GetItemRect 方法的另一个版本。To return the bounding rectangle of the entire item, use the other version of the GetItemRect method.

See also

GetItemRect(Int32)

在列表视图控件中检索特定项的边框。Retrieves the bounding rectangle for a specific item within the list view control.

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

Parameters

index
Int32

位于要返回其边框的 ListView.ListViewItemCollection 内的项的从零开始的索引。The zero-based index of the item within the ListView.ListViewItemCollection whose bounding rectangle you want to return.

Returns

Rectangle

Rectangle,表示指定的 ListViewItem 的边框。A Rectangle that represents the bounding rectangle of the specified ListViewItem.

Remarks

此版本的 GetItemRect 方法返回的边框表示整个项,包括图标、项文本和子项文本。The bounding rectangle returned by this version of the GetItemRect method represents the entire item, including the icon, item text, and subitem text. 若要指定项的边框的特定部分,请使用 GetItemRect 方法的另一个版本。To specify a specific portion of the item's bounding rectangle, use the other version of the GetItemRect method.

See also

Applies to