共用方式為


ListView 控制項概觀 (Windows Form)

更新:2007 年 11 月

Windows Form ListView 控制項顯示具有圖示的項目清單。您可以使用清單檢視來建立如 Windows 檔案總管右窗格的使用者介面。控制項有四種檢視模式:LargeIcon、SmallIcon、List 和 Details。

ListView 控制項可以做到的功能

注意事項:

「並排」是額外的檢視模式,只適用於 Windows XP 和 Windows Server 2003 作業系統。如需詳細資訊,請參閱 HOW TO:在 Windows Form ListView 控制項中啟用並排顯示

LargeIcon 模式在項目文字旁顯示大圖示;如果控制項夠大,項目會以多行顯示。SmallIcon 模式除了顯示的是小圖示之外,其餘與 LargeIcon 都相同。List 模式顯示小圖示,但一定是單行。Details 模式以多行顯示項目。如需詳細資訊,請參閱HOW TO:將資料行加入至 Windows Form ListView 控制項。檢視模式由 View 屬性決定。所有的檢視模式可以顯示來自影像清單 (Image List) 的影像。如需詳細資訊,請參閱 HOW TO:顯示 Windows Form ListView 控制項的圖示

下表列出一些 ListView 的成員,以及檢視中有效的成員。

ListView 成員

檢視

Alignment 屬性

SmallIconLargeIcon

AutoArrange 屬性

SmallIconLargeIcon

AutoResizeColumn 方法

Details

Columns 屬性

DetailsTile

DrawSubItem 事件

Details

FindItemWithText 方法

DetailsListTile

FindNearestItem 方法

SmallIconLargeIcon

GetItemAt 方法

DetailsTile

Groups 屬性

所有的檢視,除了 List

HeaderStyle 屬性

Details.

InsertionMark 屬性

LargeIconSmallIconTile

ListView 控制項的主要屬性是 Items,其中包含控制項顯示的項目。SelectedItems 屬性包含控制項中目前選取的項目集合。使用者可以選取多重項目,例如在 MultiSelect 屬性設定為 true 時,一次拖放數個項目到另一個控制項中。如果 CheckBoxes 屬性設定為 true,則 ListView 控制項可以在項目旁邊顯示核取方塊。

Activation 屬性決定使用者必須採取哪種類型的動作,才能啟動清單中的項目:選項有 StandardOneClickTwoClickOneClick 啟動需要按一下來啟動項目。TwoClick 啟動需要使用者按兩下來啟動項目;按一下則會變更項目文字的顏色。Standard 啟動需要使用者按兩下來啟動項目,但是項目的外觀不會改變。

ListView 控制項也支援 Windows XP 平台所提供的視覺化樣式和其他功能,包括群組、並排顯示和插入標記。如需詳細資訊,請參閱 Windows XP 功能和 Windows Form 控制項

請參閱

工作

HOW TO:使用 Windows Form ListView 控制項加入和移除項目

HOW TO:將資料行加入至 Windows Form ListView 控制項

HOW TO:顯示 Windows Form ListView 控制項的圖示

HOW TO:使用 Windows Form ListView 控制項以資料行顯示子項目

HOW TO:選取 Windows Form ListView 控制項中的項目

HOW TO:在 Windows Form ListView 控制項中群組項目

HOW TO:在 Windows Form ListView 控制項中顯示插入標記

HOW TO:將搜尋能力加入至 ListView 控制項

HOW TO:將自訂資訊加入 TreeView 或 ListView 控制項 (Windows Form)

逐步解說:利用 Windows Form 建立多窗格使用者介面

參考

ListView

其他資源

ListView 控制項 (Windows Form)