ListView 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表 Windows 清單檢視控制項,顯示一組可用四種不同視圖之一顯示的項目。
public ref class ListView : System::Windows::Forms::Control
public class ListView : System.Windows.Forms.Control
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)]
public class ListView : System.Windows.Forms.Control
[System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)]
public class ListView : System.Windows.Forms.Control
type ListView = class
inherit Control
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)>]
type ListView = class
inherit Control
[<System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)>]
type ListView = class
inherit Control
Public Class ListView
Inherits Control
- 繼承
- 屬性
範例
以下程式碼範例建立一個 ListView 控制項,每個項目指定三個 ListViewItem 物件與三個 ListViewItem.ListViewSubItem 物件。 範例中也會建立 ColumnHeader 物件,在詳細檢視中顯示子項目。 程式碼範例中也建立了兩個 ImageList 物件,以提供物件 ListViewItem 的影像。 這些 ImageList 物件會被 LargeImageList 加入到 和 SmallImageList 屬性中。 範例中在建立控制項 ListView 時使用了以下屬性:
這個範例需要你已經將程式碼加入 a Form ,並從建構子或其他表單中的方法呼叫範例中建立的方法。 範例也要求名為 MySmallImage1、 MySmallImage2、 MyLargeImage1和 MyLargeImage2 的映像檔必須位於磁碟 C 的根目錄中。
private:
void CreateMyListView()
{
// Create a new ListView control.
ListView^ listView1 = gcnew ListView;
listView1->Bounds = Rectangle(Point(10,10),System::Drawing::Size( 300, 200 ));
// Set the view to show details.
listView1->View = View::Details;
// Allow the user to edit item text.
listView1->LabelEdit = true;
// Allow the user to rearrange columns.
listView1->AllowColumnReorder = true;
// Display check boxes.
listView1->CheckBoxes = true;
// Select the item and subitems when selection is made.
listView1->FullRowSelect = true;
// Display grid lines.
listView1->GridLines = true;
// Sort the items in the list in ascending order.
listView1->Sorting = SortOrder::Ascending;
// Create three items and three sets of subitems for each item.
ListViewItem^ item1 = gcnew ListViewItem( "item1",0 );
// Place a check mark next to the item.
item1->Checked = true;
item1->SubItems->Add( "1" );
item1->SubItems->Add( "2" );
item1->SubItems->Add( "3" );
ListViewItem^ item2 = gcnew ListViewItem( "item2",1 );
item2->SubItems->Add( "4" );
item2->SubItems->Add( "5" );
item2->SubItems->Add( "6" );
ListViewItem^ item3 = gcnew ListViewItem( "item3",0 );
// Place a check mark next to the item.
item3->Checked = true;
item3->SubItems->Add( "7" );
item3->SubItems->Add( "8" );
item3->SubItems->Add( "9" );
// Create columns for the items and subitems.
// Width of -2 indicates auto-size.
listView1->Columns->Add( "Item Column", -2, HorizontalAlignment::Left );
listView1->Columns->Add( "Column 2", -2, HorizontalAlignment::Left );
listView1->Columns->Add( "Column 3", -2, HorizontalAlignment::Left );
listView1->Columns->Add( "Column 4", -2, HorizontalAlignment::Center );
//Add the items to the ListView.
array<ListViewItem^>^temp1 = {item1,item2,item3};
listView1->Items->AddRange( temp1 );
// Create two ImageList objects.
ImageList^ imageListSmall = gcnew ImageList;
ImageList^ imageListLarge = gcnew ImageList;
// Initialize the ImageList objects with bitmaps.
imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage1.bmp" ) );
imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage2.bmp" ) );
imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage1.bmp" ) );
imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage2.bmp" ) );
//Assign the ImageList objects to the ListView.
listView1->LargeImageList = imageListLarge;
listView1->SmallImageList = imageListSmall;
// Add the ListView to the control collection.
this->Controls->Add( listView1 );
}
private void CreateMyListView()
{
// Create a new ListView control.
ListView listView1 = new ListView();
listView1.Bounds = new Rectangle(new Point(10,10), new Size(300,200));
// Set the view to show details.
listView1.View = View.Details;
// Allow the user to edit item text.
listView1.LabelEdit = true;
// Allow the user to rearrange columns.
listView1.AllowColumnReorder = true;
// Display check boxes.
listView1.CheckBoxes = true;
// Select the item and subitems when selection is made.
listView1.FullRowSelect = true;
// Display grid lines.
listView1.GridLines = true;
// Sort the items in the list in ascending order.
listView1.Sorting = SortOrder.Ascending;
// Create three items and three sets of subitems for each item.
ListViewItem item1 = new ListViewItem("item1",0);
// Place a check mark next to the item.
item1.Checked = true;
item1.SubItems.Add("1");
item1.SubItems.Add("2");
item1.SubItems.Add("3");
ListViewItem item2 = new ListViewItem("item2",1);
item2.SubItems.Add("4");
item2.SubItems.Add("5");
item2.SubItems.Add("6");
ListViewItem item3 = new ListViewItem("item3",0);
// Place a check mark next to the item.
item3.Checked = true;
item3.SubItems.Add("7");
item3.SubItems.Add("8");
item3.SubItems.Add("9");
// Create columns for the items and subitems.
// Width of -2 indicates auto-size.
listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center);
//Add the items to the ListView.
listView1.Items.AddRange(new ListViewItem[]{item1,item2,item3});
// Create two ImageList objects.
ImageList imageListSmall = new ImageList();
ImageList imageListLarge = new ImageList();
// Initialize the ImageList objects with bitmaps.
imageListSmall.Images.Add(Bitmap.FromFile("C:\\MySmallImage1.bmp"));
imageListSmall.Images.Add(Bitmap.FromFile("C:\\MySmallImage2.bmp"));
imageListLarge.Images.Add(Bitmap.FromFile("C:\\MyLargeImage1.bmp"));
imageListLarge.Images.Add(Bitmap.FromFile("C:\\MyLargeImage2.bmp"));
//Assign the ImageList objects to the ListView.
listView1.LargeImageList = imageListLarge;
listView1.SmallImageList = imageListSmall;
// Add the ListView to the control collection.
this.Controls.Add(listView1);
}
Private Sub CreateMyListView()
' Create a new ListView control.
Dim listView1 As New ListView()
listView1.Bounds = New Rectangle(New Point(10, 10), New Size(300, 200))
' Set the view to show details.
listView1.View = View.Details
' Allow the user to edit item text.
listView1.LabelEdit = True
' Allow the user to rearrange columns.
listView1.AllowColumnReorder = True
' Display check boxes.
listView1.CheckBoxes = True
' Select the item and subitems when selection is made.
listView1.FullRowSelect = True
' Display grid lines.
listView1.GridLines = True
' Sort the items in the list in ascending order.
listView1.Sorting = SortOrder.Ascending
' Create three items and three sets of subitems for each item.
Dim item1 As New ListViewItem("item1", 0)
' Place a check mark next to the item.
item1.Checked = True
item1.SubItems.Add("1")
item1.SubItems.Add("2")
item1.SubItems.Add("3")
Dim item2 As New ListViewItem("item2", 1)
item2.SubItems.Add("4")
item2.SubItems.Add("5")
item2.SubItems.Add("6")
Dim item3 As New ListViewItem("item3", 0)
' Place a check mark next to the item.
item3.Checked = True
item3.SubItems.Add("7")
item3.SubItems.Add("8")
item3.SubItems.Add("9")
' Create columns for the items and subitems.
' Width of -2 indicates auto-size.
listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left)
listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left)
listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left)
listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center)
'Add the items to the ListView.
listView1.Items.AddRange(New ListViewItem() {item1, item2, item3})
' Create two ImageList objects.
Dim imageListSmall As New ImageList()
Dim imageListLarge As New ImageList()
' Initialize the ImageList objects with bitmaps.
imageListSmall.Images.Add(Bitmap.FromFile("C:\MySmallImage1.bmp"))
imageListSmall.Images.Add(Bitmap.FromFile("C:\MySmallImage2.bmp"))
imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLargeImage1.bmp"))
imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLargeImage2.bmp"))
'Assign the ImageList objects to the ListView.
listView1.LargeImageList = imageListLarge
listView1.SmallImageList = imageListSmall
' Add the ListView to the control collection.
Me.Controls.Add(listView1)
End Sub
備註
一個 ListView 控制項允許你顯示包含物品文字的物品清單,並可選擇性地用圖示來識別物品類型。 例如,Windows 檔案總管的檔案清單外觀類似於一個 ListView 控制項。 它會顯示目前樹中選取的檔案和資料夾清單。 每個檔案和資料夾都會顯示一個與之相關的圖示,以協助辨識檔案或資料夾的類型。 類別 ListViewItem 代表控制項中的 ListView 一個項目。 清單中顯示的項目可以以五種不同的視圖之一呈現。 項目可以顯示為大型圖示、小圖示,或在垂直列表中顯示為小圖示。 項目也可以有包含與父項目相關的資訊的子項目。 詳細檢視允許你以格子顯示項目及其子項目,並以欄標頭標示子項目中所顯示的資訊。 圖塊檢視功能有限,如下所述,允許你以包含大圖示的圖塊形式顯示該項目及其子項目,並在文字資訊旁顯示一個大型圖示。 ListView 支援單一或多重選擇。 多重選擇功能讓使用者能像控制 ListBox 項一樣從項目列表中選擇。 此外,使用者還能啟動選定的物品來執行任務。 例如,你可以使用 ListView 控制項顯示一個檔案清單,應用程式可以開啟並利用這些檔案。 使用者可以選擇要開啟的檔案,然後雙擊它們來啟動項目,並在應用程式中開啟檔案。 ListView他們也可以使用該CheckBoxes屬性顯示勾選框,讓使用者勾選想要執行動作的項目。 你可以用多種方式來操作 ListView 這個操作。 這個控制項可以用來顯示應用程式、資料庫或文字檔的資訊。 它們 ListView 也可用來從使用者獲取資訊,例如選擇一組檔案進行處理。
ListView 提供大量特性,提供外觀與行為上的彈性。 這個 View 特性允許你改變物品的展示方式。
LargeImageList這些 、 SmallImageList和 StateImageList 屬性允許你指定ImageList包含顯示項目圖片的物件,以及StateImageList在屬性設定為 true時顯示CheckBoxes的勾選框(在 的情況下)。 要判斷哪些項目被勾選,你可以使用CheckedItems該屬性來存取該收藏。ListView.CheckedListViewItemCollection 屬性 Columns 允許存取 ListView.ColumnHeaderCollection,該 儲存在 View 控制項屬性設為 Details時所顯示的欄位標頭。 物品會被加減 ListView ,透過物業 Items 進行。 這個 Items 屬性允許你存取 ListView.ListViewItemCollection 控制項目,該控制項提供了操作控制項目的方法。 如果你想讓使用者編輯項目的文字,可以使用這個 LabelEdit 屬性。 當你的控制項包含大量項目時,使用者通常更容易在排序列表中看到它們。 你可以用這個 Sorting 屬性來按字母順序排序物品。 你也可以完全自訂控制器的 ListView 外觀。 為此,將屬性設 OwnerDraw 為 true 並處理以下一個或多個事件: DrawItem, DrawSubItem, DrawColumnHeader,
當View控制項的性質被設定為 Details時,許多控制的性質ListView會被使用。 此 AllowColumnReorder 特性允許使用者 ListView 在執行時重新配置欄位順序。 這個 FullRowSelect 屬性允許選擇一個項目及其子項目,而不僅僅是項目本身。 若要在細節檢視中顯示格線以識別項目與子項目 ListView的邊界,您可以使用 屬性 GridLines 。 這個 HeaderStyle 屬性允許你指定要顯示的欄位標頭類型。
ListView控制項可在虛擬模式下運作,物件ListViewItem以動態方式產生,而非儲存在集合中Items。 這對於處理非常龐大或內容經常變動的清單非常有用。 要啟用虛擬模式,請將屬性設 VirtualMode 為 true ,並處理 RetrieveVirtualItem、 CacheVirtualItems和 SearchForVirtualItem 事件。
除了控制項可用的ListView多種屬性外,您的應用程式還可使用方法與事件,以提供額外功能。ListView BeginUpdate這些 and EndUpdate 方法可以讓你在新增多個項目ListView時,透過防止每次新增項目時控制項重新繪製來提升效能。 如果你 ListView 的控制項是顯示項目和子項目,你可能想在使用者右鍵點擊子項目時提供功能。 要判斷被點擊的子項目是哪個項目,可以使用這個 GetItemAt 方法。 在使用者編輯項目後進行驗證時,你可能想顯示特定項目給使用者修改。 EnsureVisible此方法可被呼叫以確保特定項目位於控制區的可見範圍內。
如果屬性LabelEdit設定為 true,你可以透過建立事件處理器來BeforeLabelEditAfterLabelEdit執行像是在文字變更前後驗證正在編輯的文字等任務。 要執行像是開啟檔案或顯示對話框以編輯顯示在 ListView中的項目等任務,你可以為該事件建立事件處理 ItemActivate 程序。 如果你允許使用者在點擊欄位標頭時排序 ListView 項目,你可以建立事件處理程序來 ColumnClick 執行排序。 當屬性 CheckBoxes 設定為 true時,你可以透過處理 ItemCheck 事件來判斷項目檢查狀態是否發生變化。
你也可以用該BackgroundImage屬性設定背景圖片ListView。 你的應用程式必須具備STAThreadAttributeMain正確顯示控制點背景ListView影像的方法。 此外,若 ListView Internet Explorer 中託管有帶有背景影像的控制項,請在應用程式清單檔案中指定 comctl32.dll 6.0 版本為相依組合,以確保背景影像正確顯示。
Windows XP 和 Windows Server 2003 提供三個功能,在應用程式呼叫方法Application.EnableVisualStyles時增強ListView控制功能:圖塊檢視、分組和插入標記。
圖塊視圖讓你能在圖形與文字資訊之間取得平衡,透過在大型圖示旁顯示物品與子物品文字。 將屬性 View 設定為 View.Tile 以啟用此行為。
分組功能讓你可以將物品視覺化地分成相關類別。 當你想啟用這個功能時,可以用這個 Groups 屬性把物件加入 ListViewGroup 控制項 ListView 。 要暫時停用此功能,請將屬性 ShowGroups 設定為 false。
插入標記功能讓你能提供拖放物品重新定位,並有視覺回饋指示投放位置。 使用 ListViewInsertionMark 屬性 InsertionMark 檢索的物件來顯示插入標記。
這些功能僅在 Windows XP 與 Windows Server 2003 上提供。 在早期作業系統中,與這些特性相關的程式碼沒有影響,磁磚視圖會顯示為大型圖示視圖,插入標記與群組也不會顯示。 在某些情況下,你可能想包含判斷這些功能是否可用的程式碼,並在無法使用時提供替代功能。 這些功能由提供作業系統主題功能的同一個函式庫提供。 要檢查此函式庫的可用性,呼叫 FeatureSupport.IsPresent(Object) 方法過載並傳遞 OSFeature.Themes 該值。
下表顯示部分 ListView 成員及其有效的觀點。
| 列表檢視會員 | 查看 |
|---|---|
| Alignment 屬性 | SmallIcon 或 LargeIcon |
| AutoArrange 屬性 | SmallIcon 或 LargeIcon |
| AutoResizeColumn 方法 | Details |
| Columns 屬性 | Details 或 Tile |
| DrawSubItem 事件 | Details |
| FindItemWithText 方法 | Details、 List或 Tile |
| FindNearestItem 方法 | SmallIcon 或 LargeIcon |
| GetItemAt 方法 | Details 或 Tile |
| Groups 屬性 | 所有觀點,唯獨 List |
| HeaderStyle 屬性 | Details |
| InsertionMark 屬性 | LargeIcon、 SmallIcon或 Tile |
建構函式
| 名稱 | Description |
|---|---|
| ListView() |
初始化 ListView 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| AccessibilityObject |
讓被 AccessibleObject 指派到控制室。 (繼承來源 Control) |
| AccessibleDefaultActionDescription |
取得或設定控制項的預設動作描述,供無障礙客戶端應用程式使用。 (繼承來源 Control) |
| AccessibleDescription |
取得或設定無障礙客戶端應用程式所使用的控制項描述。 (繼承來源 Control) |
| AccessibleName |
取得或設定無障礙客戶端應用程式所使用的控制項名稱。 (繼承來源 Control) |
| AccessibleRole |
取得或設定控制的可及角色。 (繼承來源 Control) |
| Activation |
取得或設定使用者必須採取的行動類型來啟動物品。 |
| Alignment |
取得或設定控制中項目的對齊。 |
| AllowColumnReorder |
取得或設定一個值,指示使用者是否可以拖曳欄位標頭以重新排序控制項中的欄位。 |
| AllowDrop |
取得或設定一個值,指示控制器是否能接受使用者拖曳到的資料。 (繼承來源 Control) |
| Anchor |
取得或設定控制項綁定容器的邊緣,並決定控制項如何與父控制項進行調整大小。 (繼承來源 Control) |
| AutoArrange |
是否會自動保留圖示,或設定。 |
| AutoScrollOffset |
取得或設定,將此控制捲動至。ScrollControlIntoView(Control) (繼承來源 Control) |
| AutoSize |
此性質對此類別無關。 (繼承來源 Control) |
| BackColor |
設定或設定背景色。 |
| BackgroundImage |
取得或設定此控制項中 ListView 顯示的背景影像。 |
| BackgroundImage |
取得或設定控制中顯示的背景影像。 (繼承來源 Control) |
| BackgroundImageLayout |
取得或設定一個 ImageLayout 數值。 |
| BackgroundImageTiled |
會取得或設定一個值,指示背景影像 ListView 是否應該鋪設平鋪。 |
| BindingContext |
取得或設定 BindingContext 控制。 (繼承來源 Control) |
| BorderStyle |
取得或設定控制的邊界風格。 |
| Bottom |
取得控制項底部邊緣與容器用戶端區域頂部邊緣之間的距離(像素)。 (繼承來源 Control) |
| Bounds |
取得或設定控制項的大小與位置,包括非用戶端元素,以像素為單位,相對於父控制項。 (繼承來源 Control) |
| CanEnableIme |
會取得一個值,表示該屬性是否 ImeMode 能被設定為主動值,以支援 IME。 (繼承來源 Control) |
| CanFocus |
會獲得一個值,表示控制點是否能獲得焦點。 (繼承來源 Control) |
| CanRaiseEvents |
判斷事件是否能在控制組上引發。 (繼承來源 Control) |
| CanSelect |
會得到一個值,表示是否可以選擇該控制項。 (繼承來源 Control) |
| Capture |
取得或設定一個值,表示控制器是否已捕捉該滑鼠。 (繼承來源 Control) |
| CausesValidation |
取得或設定一個值,指示該控制是否導致在收到焦點時對需要驗證的控制項進行驗證。 (繼承來源 Control) |
| CheckBoxes |
取得或設定一個值,指示控制項中每個項目旁是否出現勾選框。 |
| CheckedIndices |
取得目前已檢查項目的索引。 |
| CheckedItems |
會把目前已檢查的項目放在控制區。 |
| ClientRectangle |
取得代表控制區客戶端區域的矩形。 (繼承來源 Control) |
| ClientSize |
取得或設定控制區客戶區域的高度與寬度。 (繼承來源 Control) |
| Columns |
取得所有出現在控制項中的欄位標頭集合。 |
| CompanyName |
取得包含控制權的公司名稱或應用程式的創建者名稱。 (繼承來源 Control) |
| Container |
得到 IContainer 包含 Component的 。 (繼承來源 Component) |
| ContainsFocus |
會獲得一個值,表示該控制項或其子控制項目前是否擁有輸入焦點。 (繼承來源 Control) |
| ContextMenu |
已淘汰.
取得或設定與控制鍵相關的捷徑選單。 (繼承來源 Control) |
| ContextMenuStrip |
取得或設定 ContextMenuStrip 與此控制相關聯的 (繼承來源 Control) |
| Controls |
取得控制中包含的控制項集合。 (繼承來源 Control) |
| Created |
會得到一個值,表示控制是否已被建立。 (繼承來源 Control) |
| CreateParams |
此性質對此類別無關。 |
| Cursor |
當滑鼠指標位於控制器上時,會顯示或設定游標。 (繼承來源 Control) |
| DataBindings |
取得控制項的資料綁定。 (繼承來源 Control) |
| DataContext |
取得或設定資料上下文以進行資料綁定。 這是一個環境音屬性。 (繼承來源 Control) |
| DefaultCursor |
取得或設定控制鍵的預設游標。 (繼承來源 Control) |
| DefaultImeMode |
可獲得控制項所支援的預設輸入法編輯器(IME)模式。 (繼承來源 Control) |
| DefaultMargin |
取得預設控制點間設定的像素空間。 (繼承來源 Control) |
| DefaultMaximumSize |
取得控制項預設最大大小的長度與高度(像素數)。 (繼承來源 Control) |
| DefaultMinimumSize |
取得控制項預設最小大小的長度與高度(像素)。 (繼承來源 Control) |
| DefaultPadding |
取得控制項內容的預設內部間距(像素)。 (繼承來源 Control) |
| DefaultSize |
會得到預設大小的控制器。 |
| DesignMode |
會得到一個值,表示目前 Component 是否處於設計模式。 (繼承來源 Component) |
| DeviceDpi |
取得目前顯示控制項所在顯示器的 DPI 值。 (繼承來源 Control) |
| DisplayRectangle |
取得代表控制器顯示區域的矩形。 (繼承來源 Control) |
| Disposing |
會取得一個值,表示基底 Control 類別是否正在處理中。 (繼承來源 Control) |
| Dock |
取得或設定哪些控制邊界對接到其父控制,並決定控制點如何與父控制進行調整大小。 (繼承來源 Control) |
| DoubleBuffered |
會取得或設定一個值,指示該控制器是否應該使用次級緩衝區重新繪製表面以減少或防止閃爍。 |
| Enabled |
取得或設定一個值,表示控制項是否能回應使用者互動。 (繼承來源 Control) |
| Events |
會取得與此 Component連結的事件處理程序清單。 (繼承來源 Component) |
| Focused |
會得到一個值,表示控制器是否有輸入焦點。 (繼承來源 Control) |
| FocusedItem |
取得或設定目前有焦點的控制項目。 |
| Font |
取得或設定控制項顯示文字的字型。 (繼承來源 Control) |
| FontHeight |
取得或設定控制鍵字型的高度。 (繼承來源 Control) |
| ForeColor |
取得或設定前景顏色。 |
| FullRowSelect |
會取得或設定一個值,表示點擊某個項目是否會選取所有子項目。 |
| GridLines |
取得或設定一個值,指示控制項中包含項目與子項目的列與欄間是否會出現格線。 |
| GroupImageList |
目前設定的 GroupIcon 圖片清單。 |
| Groups |
取得分配給控制的物件集合 ListViewGroup 。 |
| Handle |
它會得到控制項綁定的視窗把手。 (繼承來源 Control) |
| HasChildren |
會取得一個值,表示該控制是否包含一個或多個子控制項。 (繼承來源 Control) |
| HeaderStyle |
取得或設定欄位標頭樣式。 |
| Height |
取得或設定控制點的高度。 (繼承來源 Control) |
| HideSelection |
取得或設定一個值,指示控制項在失去焦點時是否仍保持高亮。 |
| HotTracking |
取得或設定一個值,指示當滑鼠指標通過某項目或子項目的文字時,該文字是否呈現超連結的外觀。 |
| HoverSelection |
當滑鼠指標停留在該物品上方幾秒鐘時,會取得或設定一個值,表示該物品是否會自動被選取。 |
| ImeMode |
取得或設定控制器的輸入法編輯器(IME)模式。 (繼承來源 Control) |
| ImeModeBase |
取得或設定控制的 IME 模式。 (繼承來源 Control) |
| InsertionMark |
取得一個物件,用來指示物品在控制項內 ListView 拖曳時預期的投放位置。 |
| InvokeRequired |
會獲得一個值,表示呼叫者在呼叫控制項時是否必須呼叫呼叫方法,因為呼叫者使用的執行緒與該控制項建立的執行緒不同。 (繼承來源 Control) |
| IsAccessible |
取得或設定一個值,指示該控制項是否對無障礙應用程式可見。 (繼承來源 Control) |
| IsAncestorSiteInDesignMode |
顯示該控制點的前祖是否被設置在 DesignMode 中。 這個屬性是唯讀的。 (繼承來源 Control) |
| IsDisposed |
會有一個值,表示控制權是否已被處理掉。 (繼承來源 Control) |
| IsHandleCreated |
會得到一個值,表示該控制項是否有與其相關的 handle。 (繼承來源 Control) |
| IsMirrored |
會得到一個值,表示該控制是否為鏡像。 (繼承來源 Control) |
| Items |
會得到一個包含控制中所有項目的集合。 |
| LabelEdit |
取得或設定一個值,指示使用者是否能編輯控制項中的項目標籤。 |
| LabelWrap |
取得或設定一個值,表示當項目以圖示顯示時,項目標籤是否會包裹。 |
| LargeImageList |
在控制項中以大型圖示顯示物品時,可以取得或設定 ImageList 的 。 |
| LayoutEngine |
會取得控制點的佈局引擎的快取實例。 (繼承來源 Control) |
| Left |
取得或設定控制項左邊與容器客戶端區域左邊之間的距離(像素)。 (繼承來源 Control) |
| ListViewItemSorter |
取得或設定控制的排序比較器。 |
| Location |
取得或設定控制器左上角相對於容器左上角的座標。 (繼承來源 Control) |
| Margin |
取得或設定控制區之間的空格。 (繼承來源 Control) |
| MaximumSize |
取得或設定的上限是可以指定的上限 GetPreferredSize(Size) 。 (繼承來源 Control) |
| MinimumSize |
取得或設定的尺寸是可指定的下限 GetPreferredSize(Size) 。 (繼承來源 Control) |
| MultiSelect |
取得或設定一個值,表示是否可以選擇多個項目。 |
| Name |
取得或設定控制的名稱。 (繼承來源 Control) |
| OwnerDraw |
會取得或設定一個值,表示控制項是由 ListView 作業系統繪製,還是由你提供的程式碼繪製。 |
| Padding |
取得或設定控制項與其內容之間的 ListView 空間。 |
| Parent |
取得或設定控制的父容器。 (繼承來源 Control) |
| PreferredSize |
大小相當於一個長方形區域,控制器可以放進去。 (繼承來源 Control) |
| ProductName |
取得包含控制項的組件產品名稱。 (繼承來源 Control) |
| ProductVersion |
取得包含控制項的組裝版本。 (繼承來源 Control) |
| RecreatingHandle |
會取得一個值,表示該控制項目前是否正在重新建立其句柄。 (繼承來源 Control) |
| Region |
取得或設定與控制項相關的視窗區域。 (繼承來源 Control) |
| RenderRightToLeft |
已淘汰.
已淘汰.
該物業現已過時。 (繼承來源 Control) |
| ResizeRedraw |
會取得或設定一個值,表示控制項在調整時是否會自行重新繪製。 (繼承來源 Control) |
| Right |
取得控制器右邊與容器用戶端區域左邊之間的距離(像素)。 (繼承來源 Control) |
| RightToLeft |
取得或設定一個值,指示 control 元素是否對齊以支援使用右至左字型的區域。 (繼承來源 Control) |
| RightToLeftLayout |
取得或設定一個值,表示控制是從右向左排列。 |
| ScaleChildren |
會得到一個決定子控制項縮放的值。 (繼承來源 Control) |
| Scrollable |
取得或設定一個值,指示當無法顯示所有項目時,是否會新增滾動條。 |
| SelectedIndices |
取得控制中所選項目的索引。 |
| SelectedItems |
取得控制中選中的項目。 |
| ShowFocusCues |
會得到一個值,指示控制器是否應該顯示焦點矩形。 (繼承來源 Control) |
| ShowGroups |
取得或設定一個值,表示項目是否以群組顯示。 |
| ShowItemToolTips |
取得或設定一個值,指示是否顯示 ListViewItem 包含在 ListView中的物件工具提示。 |
| ShowKeyboardCues |
會取得一個值,表示使用者介面是否處於顯示或隱藏鍵盤加速器的適當狀態。 (繼承來源 Control) |
| Site |
取得或設定控制點。 (繼承來源 Control) |
| Size |
設定控制器的高度與寬度。 (繼承來源 Control) |
| SmallImageList |
在控制鍵中以小圖示顯示物品時,可以設定或設定 ImageList 。 |
| Sorting |
取得或設定控制項目的排序順序。 |
| StateImageList |
取得或設定 ImageList 與應用程式定義狀態相關的控制項。 |
| TabIndex |
取得或設定容器內控制項的制表順序。 (繼承來源 Control) |
| TabStop |
取得或設定一個值,指示使用者是否能使用 TAB 鍵將焦點分配給此控制項。 (繼承來源 Control) |
| Tag |
取得或設定包含控制項資料的物件。 (繼承來源 Control) |
| Text |
此性質對此類別無關。 |
| TileSize |
取得或設定圖塊檢視中顯示的圖塊大小。 |
| Top |
取得或設定控制面板頂端與容器用戶端區域頂端之間的距離(以像素為單位)。 (繼承來源 Control) |
| TopItem |
取得或設定控制中第一個可見的項目。 |
| TopLevelControl |
取得沒有被其他 Windows Forms 控制項保護的父控制權。 通常,這是控制所包含的最 Form 外層。 (繼承來源 Control) |
| UseCompatibleStateImageBehavior |
取得或設定一個值,指示是否 ListView 使用與 .NET Framework 1.1 或 .NET Framework 2.0 及更新版本相容的狀態映像行為。 |
| UseWaitCursor |
取得或設定一個值,指示是否使用等待游標來控制目前的控制項及所有子控制項。 (繼承來源 Control) |
| View |
設定項目在控制中如何顯示。 |
| VirtualListSize |
在虛擬模式下取得或設定列表中包含的物件數量 ListViewItem 。 |
| VirtualMode |
取得或設定一個值,表示你是否為控制系統提供了自己的資料管理操作 ListView 。 |
| Visible |
取得或設定一個值,表示該控制項及其所有子控制項是否被顯示。 (繼承來源 Control) |
| Width |
設定或設定控制寬度。 (繼承來源 Control) |
| WindowTarget |
此性質對此類別無關。 (繼承來源 Control) |
方法
事件
| 名稱 | Description |
|---|---|
| AfterLabelEdit |
當使用者編輯商品標籤時,會發生這種情況。 |
| AutoSizeChanged |
這個活動與本班無關。 (繼承來源 Control) |
| BackColorChanged |
發生於 BackColor 屬性的值變更時。 (繼承來源 Control) |
| BackgroundImageChanged |
發生於 BackgroundImage 屬性的值變更時。 |
| BackgroundImageChanged |
發生於 BackgroundImage 屬性的值變更時。 (繼承來源 Control) |
| BackgroundImageLayoutChanged |
當房產變更時 BackgroundImageLayout 發生。 |
| BeforeLabelEdit |
當使用者開始編輯商品標籤時,會發生這種情況。 |
| BindingContextChanged |
發生於 BindingContext 屬性的值變更時。 (繼承來源 Control) |
| CacheVirtualItems | |
| CausesValidationChanged |
發生於 CausesValidation 屬性的值變更時。 (繼承來源 Control) |
| ChangeUICues |
當焦點或鍵盤使用者介面(UI)提示改變時,會發生這種情況。 (繼承來源 Control) |
| Click |
當按下控制器時會發生。 (繼承來源 Control) |
| ClientSizeChanged |
發生於 ClientSize 屬性的值變更時。 (繼承來源 Control) |
| ColumnClick |
當使用者點擊列表檢視控制項中的欄位標頭時,會發生這種情況。 |
| ColumnReordered |
當欄位標頭順序改變時,會發生這種情況。 |
| ColumnWidthChanged |
發生在成功改變欄位寬度之後。 |
| ColumnWidthChanging |
當一列的寬度改變時,會發生這種情況。 |
| ContextMenuChanged |
已淘汰.
發生於 ContextMenu 屬性的值變更時。 (繼承來源 Control) |
| ContextMenuStripChanged |
發生於 ContextMenuStrip 屬性的值變更時。 (繼承來源 Control) |
| ControlAdded |
當新增控制項加入 Control.ControlCollection時,會發生。 (繼承來源 Control) |
| ControlRemoved |
當控制項從 中移除 Control.ControlCollection時發生。 (繼承來源 Control) |
| CursorChanged |
發生於 Cursor 屬性的值變更時。 (繼承來源 Control) |
| DataContextChanged |
發生於 DataContext 屬性的值變更時。 (繼承來源 Control) |
| Disposed |
當元件被呼叫方法 Dispose() 時會發生。 (繼承來源 Component) |
| DockChanged |
發生於 Dock 屬性的值變更時。 (繼承來源 Control) |
| DoubleClick |
當雙擊按鈕時會發生。 (繼承來源 Control) |
| DpiChangedAfterParent |
當控制器的 DPI 設定在父控制器或表單的 DPI 改變後,程式方式更改時會發生。 (繼承來源 Control) |
| DpiChangedBeforeParent |
當控制器的 DPI 設定在父控制器或表單的 DPI 變更事件尚未發生之前,程式化地更改時就會發生。 (繼承來源 Control) |
| DragDrop |
當拖放操作完成時會發生。 (繼承來源 Control) |
| DragEnter |
當物體被拖入控制範圍時,會發生這種情況。 (繼承來源 Control) |
| DragLeave |
當物體被拖出控制範圍時,會發生這種情況。 (繼承來源 Control) |
| DragOver |
當物體被拖過控制範圍時會發生。 (繼承來源 Control) |
| DrawColumnHeader | |
| DrawItem | |
| DrawSubItem | |
| EnabledChanged |
發生於 Enabled 屬性值變更時。 (繼承來源 Control) |
| Enter |
當進入控制區時發生。 (繼承來源 Control) |
| FontChanged |
當房產價值變動時 Font 發生。 (繼承來源 Control) |
| ForeColorChanged |
當房產價值變動時 ForeColor 發生。 (繼承來源 Control) |
| GiveFeedback |
發生在拖曳操作期間。 (繼承來源 Control) |
| GotFocus |
當控制裝置被聚焦時發生。 (繼承來源 Control) |
| GroupCollapsedStateChanged |
當 在 上ListViewGroup發生CollapsedState變化時。 |
| GroupTaskLinkClick |
當使用者點擊 a TaskLink 在 ListViewGroup. |
| HandleCreated |
當控制器被建立把柄時,會發生這種情況。 (繼承來源 Control) |
| HandleDestroyed |
當控制器的把手正在被摧毀時,會發生這種情況。 (繼承來源 Control) |
| HelpRequested |
當使用者請求控制權協助時會發生。 (繼承來源 Control) |
| ImeModeChanged |
當房產發生變化時 ImeMode 。 (繼承來源 Control) |
| Invalidated |
當控制器顯示需要重新繪製時,會發生這種情況。 (繼承來源 Control) |
| ItemActivate |
當物品被啟動時發生。 |
| ItemCheck |
當項目的檢查狀態改變時,會發生這種情況。 |
| ItemChecked |
當項目的檢查狀態改變時,會發生這種情況。 |
| ItemDrag |
當使用者開始拖曳物品時會發生。 |
| ItemMouseHover |
當滑鼠懸停在物品上時會發生。 |
| ItemSelectionChanged |
當項目的選擇狀態改變時,會發生這種情況。 |
| KeyDown |
當按鍵時,控制器處於焦點狀態時會發生。 (繼承來源 Control) |
| KeyPress |
當按鍵在控制鍵處於焦點狀態時,按下字元、空白鍵或退格鍵時會發生。 (繼承來源 Control) |
| KeyUp |
當控制鍵處於對焦狀態時放開鍵時會發生。 (繼承來源 Control) |
| Layout |
當控制項應該重新定位其子控制項時,會發生這種情況。 (繼承來源 Control) |
| Leave |
當輸入焦點離開控制器時會發生。 (繼承來源 Control) |
| LocationChanged |
發生於 Location 屬性值變更時。 (繼承來源 Control) |
| LostFocus |
當控制失焦時會發生。 (繼承來源 Control) |
| MarginChanged |
當對照組的邊界改變時會發生。 (繼承來源 Control) |
| MouseCaptureChanged |
當控制組失去滑鼠捕捉時會發生。 (繼承來源 Control) |
| MouseClick |
當滑鼠點擊控制鍵時會發生。 (繼承來源 Control) |
| MouseDoubleClick |
當滑鼠雙擊控制鍵時會發生。 (繼承來源 Control) |
| MouseDown |
當滑鼠指標放在控制器上,按下滑鼠按鈕時會發生。 (繼承來源 Control) |
| MouseEnter |
當滑鼠指標進入控制鍵時會發生。 (繼承來源 Control) |
| MouseHover |
當滑鼠指標放在控制器上時會發生。 (繼承來源 Control) |
| MouseLeave |
當滑鼠指標離開控制鍵時會發生。 (繼承來源 Control) |
| MouseMove |
當滑鼠指標移到控制器上時會發生。 (繼承來源 Control) |
| MouseUp |
當滑鼠指標放在控制器上方並放開滑鼠按鈕時,會發生這種情況。 (繼承來源 Control) |
| MouseWheel |
當滑鼠滾輪移動時,控制器仍保持對焦。 (繼承來源 Control) |
| Move |
當控制桿移動時會發生。 (繼承來源 Control) |
| PaddingChanged |
發生於 Padding 屬性的值變更時。 |
| Paint |
當控制器被塗漆時 ListView 會發生。 |
| ParentChanged |
當房產價值變動時 Parent 發生。 (繼承來源 Control) |
| PreviewKeyDown |
當按鍵在該控制鍵上時,會發生在事件發生 KeyDown 前。 (繼承來源 Control) |
| QueryAccessibilityHelp |
當 AccessibleObject 提供無障礙應用程式協助時,會發生這種情況。 (繼承來源 Control) |
| QueryContinueDrag |
發生在拖放操作期間,使拖曳源判斷是否應該取消拖放操作。 (繼承來源 Control) |
| RegionChanged |
發生於 Region 屬性的值變更時。 (繼承來源 Control) |
| Resize |
當控制大小被調整時會發生。 (繼承來源 Control) |
| RetrieveVirtualItem |
當 處於 ListView 虛擬模式且需要 時 ListViewItem會發生。 |
| RightToLeftChanged |
當房產價值變動時 RightToLeft 發生。 (繼承來源 Control) |
| RightToLeftLayoutChanged |
發生於 RightToLeftLayout 屬性的值變更時。 |
| SearchForVirtualItem |
當 在 ListView 虛擬模式下進行搜尋時會發生。 |
| SelectedIndexChanged |
當集合變更 SelectedIndices 時會發生。 |
| SizeChanged |
當房產價值變動時 Size 發生。 (繼承來源 Control) |
| StyleChanged |
當控制風格改變時會發生。 (繼承來源 Control) |
| SystemColorsChanged |
當系統顏色改變時會發生。 (繼承來源 Control) |
| TabIndexChanged |
當房產價值變動時 TabIndex 發生。 (繼承來源 Control) |
| TabStopChanged |
當房產價值變動時 TabStop 發生。 (繼承來源 Control) |
| TextChanged |
當房產變更時 Text 發生。 |
| Validated |
當控制驗證完成時發生。 (繼承來源 Control) |
| Validating |
當對照組進行驗證時會發生。 (繼承來源 Control) |
| VirtualItemsSelectionRangeChanged |
當 a ListView 處於虛擬模式且某一範圍的選取狀態改變時,會發生這種情況。 |
| VisibleChanged |
當房產價值變動時 Visible 發生。 (繼承來源 Control) |
明確介面實作
| 名稱 | Description |
|---|---|
| IDropTarget.OnDragDrop(DragEventArgs) |
引發 DragDrop 事件。 (繼承來源 Control) |
| IDropTarget.OnDragEnter(DragEventArgs) |
引發 DragEnter 事件。 (繼承來源 Control) |
| IDropTarget.OnDragLeave(EventArgs) |
引發 DragLeave 事件。 (繼承來源 Control) |
| IDropTarget.OnDragOver(DragEventArgs) |
引發 DragOver 事件。 (繼承來源 Control) |