ListView.FocusedItem Property

Definition

获取或设置当前具有焦点的控件中的项。Gets or sets the item in the control that currently has focus.

public:
 property System::Windows::Forms::ListViewItem ^ FocusedItem { System::Windows::Forms::ListViewItem ^ get(); void set(System::Windows::Forms::ListViewItem ^ value); };
public:
 property System::Windows::Forms::ListViewItem ^ FocusedItem { System::Windows::Forms::ListViewItem ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.ListViewItem FocusedItem { get; set; }
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.ListViewItem FocusedItem { get; }
member this.FocusedItem : System.Windows.Forms.ListViewItem with get, set
member this.FocusedItem : System.Windows.Forms.ListViewItem
Public Property FocusedItem As ListViewItem
Public ReadOnly Property FocusedItem As ListViewItem

Property Value

ListViewItem

表示具有焦点的项的 ListViewItem;如果 ListView 中的所有项都不具有焦点,则为 nullA ListViewItem that represents the item that has focus, or null if no item has the focus in the ListView.

Attributes

Remarks

FocusedItem 属性返回表示当前为 ListView 控件显示聚焦框的项的 ListViewItemThe FocusedItem property returns the ListViewItem that represents the item currently displaying the focus rectangle for the ListView control. 因为 ListView 控件没有直接可编辑的区域,而不是它所显示的项,所以当 ListView 控件具有焦点时,ListView 中的项将在其项文本周围显示焦点 reticle。Because a ListView control has no directly editable areas other than the items it displays, when the ListView control has focus, an item within the ListView displays the focus reticle around its item text. 通常,ListView 控件中最后一个选定的项是具有焦点的项。Typically, the last selected item in the ListView control is the item with focus. 尽管项可能是显示焦点 reticle 的项,但实际上可能并不是 ListView中的选定项。Although an item may be the one displaying the focus reticle, it may not actually be a selected item in the ListView. 使用 SelectedItemsSelectedIndices 属性获取 ListView 控件中的选定项,不一定要选择 FocusedItem 属性。Use the SelectedItems or SelectedIndices properties to obtain the selected items in the ListView control, the FocusedItem property is not necessarily selected. 您可以使用 FocusedItem 属性来确定最后单击 ListView 控件中的项,而不考虑选择状态。You can use the FocusedItem property to determine which item was last clicked in the ListView control, regardless of selection state.

Applies to

See also