Share via


如何:選取 Windows Form ListView 控制項中的項目

此範例示範如何以程式設計方式選取 Windows Forms ListView 控制項中的專案。 以程式設計方式選取專案並不會自動將焦點變更為 ListView 控制項。 基於這個理由,您通常也會想要在選取專案時將專案設定為焦點。

範例

this.listView1.Items[0].Focused = true;
this.listView1.Items[0].Selected = true;
me.ListView1.Items(0).Focused = True
me.ListView1.Items(0).Selected = True

編譯程式碼

這個範例需要:

另請參閱