ListView.GetItemRect 方法

定义

在控件中检索项的边框。

重载

GetItemRect(Int32)

在列表视图控件中检索特定项的边框。

GetItemRect(Int32, ItemBoundsPortion)

在列表视图控件中检索指定项的边框的指定部分。

GetItemRect(Int32)

在列表视图控件中检索特定项的边框。

public System.Drawing.Rectangle GetItemRect (int index);

参数

index
Int32

位于要返回其边框的 ListView.ListViewItemCollection 内的项的从零开始的索引。

返回

Rectangle,表示指定的 ListViewItem 的边框。

注解

此版本的 方法返回的 GetItemRect 边框表示整个项,包括图标、项文本和子项文本。 若要指定项边框的特定部分,请使用 方法的其他版本 GetItemRect

另请参阅

适用于

.NET Framework 4.8.1 和其他版本
产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

GetItemRect(Int32, ItemBoundsPortion)

在列表视图控件中检索指定项的边框的指定部分。

public System.Drawing.Rectangle GetItemRect (int index, System.Windows.Forms.ItemBoundsPortion portion);

参数

index
Int32

位于要返回其边框的 ListView.ListViewItemCollection 内的项的从零开始的索引。

portion
ItemBoundsPortion

ItemBoundsPortion 值之一,表示要为其检索边框的 ListViewItem 的一部分。

返回

Rectangle,表示指定 ListViewItem 的指定部分的边框。

注解

此版本的 方法返回的 GetItemRect 边框仅表示 参数中指定的 portion 项的节。 若要返回整个项的边框,请使用 方法的另一个 GetItemRect 版本。

另请参阅

适用于

.NET Framework 4.8.1 和其他版本
产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9