View 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
목록 항목이 ListView 컨트롤에 표시되는 방식을 지정합니다.
public enum class View
public enum View
type View =
Public Enum View
- 상속
필드
| Name | 값 | Description |
|---|---|---|
| LargeIcon | 0 | 각 항목은 아래에 레이블이 있는 전체 크기 아이콘으로 표시됩니다. |
| Details | 1 | 각 항목은 열에 정렬된 각 항목에 대한 추가 정보와 함께 별도의 줄에 나타납니다. 가장 왼쪽 열에는 작은 아이콘과 레이블이 포함되며, 후속 열에는 애플리케이션에서 지정한 하위 항목이 포함됩니다. 열에는 열에 대한 캡션을 표시할 수 있는 머리글이 표시됩니다. 사용자는 런타임에 각 열의 크기를 조정할 수 있습니다. |
| SmallIcon | 2 | 각 항목은 오른쪽에 레이블이 있는 작은 아이콘으로 나타납니다. |
| List | 3 | 각 항목은 오른쪽에 레이블이 있는 작은 아이콘으로 나타납니다. 항목은 열 머리글이 없는 열로 정렬됩니다. |
| Tile | 4 | 각 항목은 항목 레이블과 하위 항목 정보가 오른쪽에 있는 전체 크기 아이콘으로 표시됩니다. 표시되는 하위 항목 정보는 애플리케이션에 의해 지정됩니다. 이 보기는 Windows XP 및 Windows Server 2003 제품군에서만 사용할 수 있습니다. 이전 운영 체제에서는 이 값이 무시되고 컨트롤이 ListView 보기에 LargeIcon 표시됩니다. |
예제
다음 코드 예제에서는 열거형 값 중 View 하나로 속성을 설정 ListView.View 하는 방법을 보여 줍니다. 예제를 실행하려면 다음 코드를 폼에 붙여넣고 폼의 생성자 또는 Load 메서드에서 메서드를 호출 InitializeListView 합니다.
internal:
// Declare the Listview object.
System::Windows::Forms::ListView^ myListView;
private:
// Initialize the ListView object with subitems of a different
// style than the default styles for the ListView.
void InitializeListView()
{
// Set the Location, View and Width properties for the
// ListView object.
myListView = gcnew ListView;
myListView->Location = System::Drawing::Point( 20, 20 );
myListView->Width = 250;
// The View property must be set to Details for the
// subitems to be visible.
myListView->View = View::Details;
// Each SubItem object requires a column, so add three columns.
this->myListView->Columns->Add( "Key", 50, HorizontalAlignment::Left );
this->myListView->Columns->Add( "A", 100, HorizontalAlignment::Left );
this->myListView->Columns->Add( "B", 100, HorizontalAlignment::Left );
// Add a ListItem object to the ListView.
ListViewItem^ entryListItem = myListView->Items->Add( "Items" );
// Set UseItemStyleForSubItems property to false to change
// look of subitems.
entryListItem->UseItemStyleForSubItems = false;
// Add the expense subitem.
ListViewItem::ListViewSubItem ^ expenseItem = entryListItem->SubItems->Add( "Expense" );
// Change the expenseItem object's color and font.
expenseItem->ForeColor = System::Drawing::Color::Red;
expenseItem->Font = gcnew System::Drawing::Font( "Arial",10,System::Drawing::FontStyle::Italic );
// Add a subitem called revenueItem
ListViewItem::ListViewSubItem ^ revenueItem = entryListItem->SubItems->Add( "Revenue" );
// Change the revenueItem object's color and font.
revenueItem->ForeColor = System::Drawing::Color::Blue;
revenueItem->Font = gcnew System::Drawing::Font( "Times New Roman",10,System::Drawing::FontStyle::Bold );
// Add the ListView to the form.
this->Controls->Add( this->myListView );
}
// Declare the Listview object.
internal System.Windows.Forms.ListView myListView;
// Initialize the ListView object with subitems of a different
// style than the default styles for the ListView.
private void InitializeListView()
{
// Set the Location, View and Width properties for the
// ListView object.
myListView = new ListView();
myListView.Location = new System.Drawing.Point(20, 20);
myListView.Width = 250;
// The View property must be set to Details for the
// subitems to be visible.
myListView.View = View.Details;
// Each SubItem object requires a column, so add three columns.
this.myListView.Columns.Add("Key", 50, HorizontalAlignment.Left);
this.myListView.Columns.Add("A", 100, HorizontalAlignment.Left);
this.myListView.Columns.Add("B", 100, HorizontalAlignment.Left);
// Add a ListItem object to the ListView.
ListViewItem entryListItem = myListView.Items.Add("Items");
// Set UseItemStyleForSubItems property to false to change
// look of subitems.
entryListItem.UseItemStyleForSubItems = false;
// Add the expense subitem.
ListViewItem.ListViewSubItem expenseItem =
entryListItem.SubItems.Add("Expense");
// Change the expenseItem object's color and font.
expenseItem.ForeColor = System.Drawing.Color.Red;
expenseItem.Font = new System.Drawing.Font(
"Arial", 10, System.Drawing.FontStyle.Italic);
// Add a subitem called revenueItem
ListViewItem.ListViewSubItem revenueItem =
entryListItem.SubItems.Add("Revenue");
// Change the revenueItem object's color and font.
revenueItem.ForeColor = System.Drawing.Color.Blue;
revenueItem.Font = new System.Drawing.Font(
"Times New Roman", 10, System.Drawing.FontStyle.Bold);
// Add the ListView to the form.
this.Controls.Add(this.myListView);
}
' Declare the Listview object.
Friend WithEvents myListView As System.Windows.Forms.ListView
' Initialize the ListView object with subitems of a different
' style than the default styles for the ListView.
Private Sub InitializeListView()
' Set the Location, View and Width properties for the
' ListView object.
myListView = New ListView
With (myListView)
.Location = New System.Drawing.Point(20, 20)
' The View property must be set to Details for the
' subitems to be visible.
.View = View.Details
.Width = 250
End With
' Each SubItem object requires a column, so add three columns.
Me.myListView.Columns.Add("Key", 50, HorizontalAlignment.Left)
Me.myListView.Columns.Add("A", 100, HorizontalAlignment.Left)
Me.myListView.Columns.Add("B", 100, HorizontalAlignment.Left)
' Add a ListItem object to the ListView.
Dim entryListItem As ListViewItem = myListView.Items.Add("Items")
' Set UseItemStyleForSubItems property to false to change
' look of subitems.
entryListItem.UseItemStyleForSubItems = False
' Add the expense subitem.
Dim expenseItem As ListViewItem.ListViewSubItem = _
entryListItem.SubItems.Add("Expense")
' Change the expenseItem object's color and font.
expenseItem.ForeColor = System.Drawing.Color.Red
expenseItem.Font = New System.Drawing.Font _
("Arial", 10, System.Drawing.FontStyle.Italic)
' Add a subitem called revenueItem
Dim revenueItem As ListViewItem.ListViewSubItem = _
entryListItem.SubItems.Add("Revenue")
' Change the revenueItem object's color and font.
revenueItem.ForeColor = System.Drawing.Color.Blue
revenueItem.Font = New System.Drawing.Font _
("Times New Roman", 10, System.Drawing.FontStyle.Bold)
' Add the ListView to the form.
Me.Controls.Add(Me.myListView)
End Sub
설명
이 열거형의 멤버를 사용하여 컨트롤의 View 속성 ListView 값을 설정합니다.