ListViewGroup 생성자

정의

ListViewGroup 클래스의 새 인스턴스를 초기화합니다.

오버로드

Name Description
ListViewGroup()

"ListViewGroup"의 ListViewGroup 기본 헤더 텍스트와 기본 왼쪽 헤더 맞춤을 사용하여 클래스의 새 인스턴스를 초기화합니다.

ListViewGroup(String)

지정된 값을 사용하여 속성을 초기화하고 기본 왼쪽 헤더 맞춤을 사용하여 클래스의 새 인스턴스 ListViewGroup 를 초기화 Header 합니다.

ListViewGroup(String, String)

지정된 값을 사용하여 클래스의 ListViewGroup 새 인스턴스를 초기화하여 및 Name 속성을 초기화 Header 합니다.

ListViewGroup(String, HorizontalAlignment)

지정된 헤더 텍스트와 지정된 헤더 맞춤을 사용하여 클래스의 ListViewGroup 새 인스턴스를 초기화합니다.

ListViewGroup()

Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs

"ListViewGroup"의 ListViewGroup 기본 헤더 텍스트와 기본 왼쪽 헤더 맞춤을 사용하여 클래스의 새 인스턴스를 초기화합니다.

public:
 ListViewGroup();
public ListViewGroup();
Public Sub New ()

적용 대상

ListViewGroup(String)

Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs

지정된 값을 사용하여 속성을 초기화하고 기본 왼쪽 헤더 맞춤을 사용하여 클래스의 새 인스턴스 ListViewGroup 를 초기화 Header 합니다.

public:
 ListViewGroup(System::String ^ header);
public ListViewGroup(string header);
public ListViewGroup(string? header);
new System.Windows.Forms.ListViewGroup : string -> System.Windows.Forms.ListViewGroup
Public Sub New (header As String)

매개 변수

header
String

그룹 머리글에 대해 표시할 텍스트입니다.

적용 대상

ListViewGroup(String, String)

Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs

지정된 값을 사용하여 클래스의 ListViewGroup 새 인스턴스를 초기화하여 및 Name 속성을 초기화 Header 합니다.

public:
 ListViewGroup(System::String ^ key, System::String ^ headerText);
public ListViewGroup(string key, string headerText);
public ListViewGroup(string? key, string? headerText);
new System.Windows.Forms.ListViewGroup : string * string -> System.Windows.Forms.ListViewGroup
Public Sub New (key As String, headerText As String)

매개 변수

key
String

속성의 초기 값입니다 Name .

headerText
String

속성의 초기 값입니다 Header .

적용 대상

ListViewGroup(String, HorizontalAlignment)

Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs
Source:
ListViewGroup.cs

지정된 헤더 텍스트와 지정된 헤더 맞춤을 사용하여 클래스의 ListViewGroup 새 인스턴스를 초기화합니다.

public:
 ListViewGroup(System::String ^ header, System::Windows::Forms::HorizontalAlignment headerAlignment);
public ListViewGroup(string header, System.Windows.Forms.HorizontalAlignment headerAlignment);
public ListViewGroup(string? header, System.Windows.Forms.HorizontalAlignment headerAlignment);
new System.Windows.Forms.ListViewGroup : string * System.Windows.Forms.HorizontalAlignment -> System.Windows.Forms.ListViewGroup
Public Sub New (header As String, headerAlignment As HorizontalAlignment)

매개 변수

header
String

그룹 머리글에 대해 표시할 텍스트입니다.

headerAlignment
HorizontalAlignment

머리글 텍스트의 HorizontalAlignment 맞춤을 지정하는 값 중 하나입니다.

예제

다음 코드 예제에서는 세부 정보 보기에서 ListViewGroup 하위 항목 값으로 항목을 구성 ListView 하는 애플리케이션에서 생성자를 사용할 수 있는 방법을 보여 줍니다. 이러한 형태의 그룹화는 Windows 탐색기에서 사용되는 그룹화와 유사합니다. 이 예제에서는 그룹이 동적으로 만들어집니다. 각 하위 항목 열에 대해 고유한 각 하위 항목 값에 대해 하나의 그룹이 만들어집니다. 부모 항목 열의 경우 각 고유한 초기 문자에 대해 하나의 그룹이 만들어집니다. 각 열에 대해 만든 그룹은 하위 항목 텍스트 또는 초기 문자와 함께 해시 테이블에 저장됩니다. 열 머리글을 클릭하면 이 텍스트 값이 적절한 열에 대한 항목과 그룹을 일치시킬 때 사용됩니다.

전체 예제는 개요 참조 항목을 참조 ListViewGroup 하세요.

   // Creates a Hashtable object with one entry for each unique
   // subitem value (or initial letter for the parent item)
   // in the specified column.
private:
   Hashtable^ CreateGroupsTable(int column)
   {
      // Create a Hashtable object.
      Hashtable^ groups = gcnew Hashtable();

      // Iterate through the items in myListView.
      IEnumerator^ myEnum1 = myListView->Items->GetEnumerator();
      while (myEnum1->MoveNext())
      {
         ListViewItem^ item = safe_cast<ListViewItem^>(myEnum1->Current);
         // Retrieve the text value for the column.
         String^ subItemText = item->SubItems[column]->Text;

         // Use the initial letter instead if it is the first column.
         if (column == 0) 
         {
            subItemText = subItemText->Substring(0, 1);
         }

         // If the groups table does not already contain a group
         // for the subItemText value, add a new group using the 
         // subItemText value for the group header and Hashtable key.
         if (!groups->Contains(subItemText))
         {
            groups->Add( subItemText, gcnew ListViewGroup(subItemText, 
               HorizontalAlignment::Left) );
         }
      }

      // Return the Hashtable object.
      return groups;
   }
// Creates a Hashtable object with one entry for each unique
// subitem value (or initial letter for the parent item)
// in the specified column.
private Hashtable CreateGroupsTable(int column)
{
    // Create a Hashtable object.
    Hashtable groups = new Hashtable();

    // Iterate through the items in myListView.
    foreach (ListViewItem item in myListView.Items)
    {
        // Retrieve the text value for the column.
        string subItemText = item.SubItems[column].Text;

        // Use the initial letter instead if it is the first column.
        if (column == 0) 
        {
            subItemText = subItemText.Substring(0, 1);
        }

        // If the groups table does not already contain a group
        // for the subItemText value, add a new group using the 
        // subItemText value for the group header and Hashtable key.
        if (!groups.Contains(subItemText))
        {
            groups.Add( subItemText, new ListViewGroup(subItemText, 
                HorizontalAlignment.Left) );
        }
    }

    // Return the Hashtable object.
    return groups;
}
' Creates a Hashtable object with one entry for each unique
' subitem value (or initial letter for the parent item)
' in the specified column.
Private Function CreateGroupsTable(column As Integer) As Hashtable
    ' Create a Hashtable object.
    Dim groups As New Hashtable()
    
    ' Iterate through the items in myListView.
    Dim item As ListViewItem
    For Each item In myListView.Items
        ' Retrieve the text value for the column.
        Dim subItemText As String = item.SubItems(column).Text
        
        ' Use the initial letter instead if it is the first column.
        If column = 0 Then
            subItemText = subItemText.Substring(0, 1)
        End If 

        ' If the groups table does not already contain a group
        ' for the subItemText value, add a new group using the 
        ' subItemText value for the group header and Hashtable key.
        If Not groups.Contains(subItemText) Then
            groups.Add( subItemText, New ListViewGroup(subItemText, _
                HorizontalAlignment.Left) )
        End If
    Next item
    
    ' Return the Hashtable object.
    Return groups
End Function 'CreateGroupsTable

적용 대상