ColumnHeader 클래스

정의

ListView 컨트롤에 단일 열 머리글을 표시합니다.

public ref class ColumnHeader : System::ComponentModel::Component, ICloneable
public class ColumnHeader : System.ComponentModel.Component, ICloneable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ColumnHeaderConverter))]
public class ColumnHeader : System.ComponentModel.Component, ICloneable
type ColumnHeader = class
    inherit Component
    interface ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ColumnHeaderConverter))>]
type ColumnHeader = class
    inherit Component
    interface ICloneable
Public Class ColumnHeader
Inherits Component
Implements ICloneable
상속
특성
구현

예제

다음 코드 예제에서는 초기화를 보여 줍니다는 컨트롤입니다 ListView . 이 예제에서는 개체를 만들고 ColumnHeader 열 머리글의 Text, TextAlignWidth 속성을 설정합니다. 이 예제에서는 항목 및 하위 항목도 에 ListView추가합니다. 폼 및 호출에서이 예제에서는 다음 코드를 붙여넣습니다를 실행 하는 PopulateListView 폼의 생성자에서 메서드 또는 Load 이벤트 처리기입니다.

private:
   void PopulateListView()
   {
      ListView1->Width = 270;
      ListView1->Location = System::Drawing::Point( 10, 10 );
      
      // Declare and construct the ColumnHeader objects.
      ColumnHeader^ header1;
      ColumnHeader^ header2;
      header1 = gcnew ColumnHeader;
      header2 = gcnew ColumnHeader;
      
      // Set the text, alignment and width for each column header.
      header1->Text = "File name";
      header1->TextAlign = HorizontalAlignment::Left;
      header1->Width = 70;
      header2->TextAlign = HorizontalAlignment::Left;
      header2->Text = "Location";
      header2->Width = 200;
      
      // Add the headers to the ListView control.
      ListView1->Columns->Add( header1 );
      ListView1->Columns->Add( header2 );
            
      // Specify that each item appears on a separate line.
      ListView1->View = View::Details;

      // Populate the ListView.Items property.
      // Set the directory to the sample picture directory.
      System::IO::DirectoryInfo^ dirInfo = gcnew System::IO::DirectoryInfo( "C:\\Documents and Settings\\All Users"
      "\\Documents\\My Pictures\\Sample Pictures" );
      
      // Get the .jpg files from the directory
      array<System::IO::FileInfo^>^files = dirInfo->GetFiles( "*.jpg" );
      
      // Add each file name and full name including path
      // to the ListView.
      if ( files != nullptr )
      {
         System::Collections::IEnumerator^ myEnum = files->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            System::IO::FileInfo^ file = safe_cast<System::IO::FileInfo^>(myEnum->Current);
            ListViewItem^ item = gcnew ListViewItem( file->Name );
            item->SubItems->Add( file->FullName );
            ListView1->Items->Add( item );
         }
      }
   }
private void PopulateListView()
{
    ListView1.Width = 270;
    ListView1.Location = new System.Drawing.Point(10, 10);

    // Declare and construct the ColumnHeader objects.
    ColumnHeader header1, header2;
    header1 = new ColumnHeader();
    header2 = new ColumnHeader();

    // Set the text, alignment and width for each column header.
    header1.Text = "File name";
    header1.TextAlign = HorizontalAlignment.Left;
    header1.Width = 70;

    header2.TextAlign = HorizontalAlignment.Left;
    header2.Text = "Location";
    header2.Width = 200;

    // Add the headers to the ListView control.
    ListView1.Columns.Add(header1);
    ListView1.Columns.Add(header2);

    // Specify that each item appears on a separate line.
    ListView1.View = View.Details;
    
    // Populate the ListView.Items property.
    // Set the directory to the sample picture directory.
    System.IO.DirectoryInfo dirInfo = 
        new System.IO.DirectoryInfo(
        "C:\\Documents and Settings\\All Users" +
        "\\Documents\\My Pictures\\Sample Pictures");

    // Get the .jpg files from the directory
    System.IO.FileInfo[] files = dirInfo.GetFiles("*.jpg");

    // Add each file name and full name including path
    // to the ListView.
    if (files != null)
    {
        foreach ( System.IO.FileInfo file in files )
        {
            ListViewItem item = new ListViewItem(file.Name);
            item.SubItems.Add(file.FullName);
            ListView1.Items.Add(item);
        }
    }
}
Private Sub PopulateListView()
    ListView1.Width = 270
    ListView1.Location = New System.Drawing.Point(10, 10)

    ' Declare and construct the ColumnHeader objects.
    Dim header1, header2 As ColumnHeader
    header1 = New ColumnHeader
    header2 = New ColumnHeader

    ' Set the text, alignment and width for each column header.
    header1.Text = "File name"
    header1.TextAlign = HorizontalAlignment.Left
    header1.Width = 70

    header2.TextAlign = HorizontalAlignment.Left
    header2.Text = "Location"
    header2.Width = 200

    ' Add the headers to the ListView control.
    ListView1.Columns.Add(header1)
    ListView1.Columns.Add(header2)

    ' Specify that each item appears on a separate line.
    ListView1.View = View.Details

    ' Populate the ListView.Items property.
    ' Set the directory to the sample picture directory.
    Dim dirInfo As New System.IO.DirectoryInfo _
        ("C:\Documents and Settings\All Users" _
        & "\Documents\My Pictures\Sample Pictures")
    Dim file As System.IO.FileInfo

    ' Get the .jpg files from the directory
    Dim files() As System.io.FileInfo = dirInfo.GetFiles("*.jpg")

    ' Add each file name and full name including path
    ' to the ListView.
    If (files IsNot Nothing) Then
        For Each file In files
            Dim item As New ListViewItem(file.Name)
            item.SubItems.Add(file.FullName)
            ListView1.Items.Add(item)
        Next
    End If
End Sub

설명

열 머리글은 머리글 텍스트를 포함하는 컨트롤의 항목 ListView 입니다. ColumnHeader개체는 클래스의 ListView.ColumnHeaderCollection 메서드를 ListViewAdd 사용하여 에 추가할 수 있습니다. 열 ListView그룹을 에 추가하려면 클래스의 메서드를 AddRangeListView.ColumnHeaderCollection 사용할 수 있습니다. 사용할 수 있습니다는 Index 의 속성을 ColumnHeader 확인 ColumnHeader 하는 클래스는 위치는 합니다 ListView.ColumnHeaderCollection.

ColumnHeaderTextTextAlign 속성을 제공하여 컨트롤에 표시되는 텍스트와 열 머리글의 텍스트 맞춤을 설정합니다. 여부를 확인 하려면는 ColumnHeader 컨트롤과 ListView 연결 된 속성을 참조할 ListView 수 있습니다. 다른 ListView 컨트롤에서 사용하기 위해 을 ColumnHeader 복사하려는 경우 메서드를 Clone 사용할 수 있습니다.

생성자

ColumnHeader()

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

ColumnHeader(Int32)

지정된 이미지를 사용하여 ColumnHeader 클래스의 새 인스턴스를 초기화합니다.

ColumnHeader(String)

지정된 이미지를 사용하여 ColumnHeader 클래스의 새 인스턴스를 초기화합니다.

속성

CanRaiseEvents

구성 요소가 이벤트를 발생시킬 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
Container

IContainer을 포함하는 Component를 가져옵니다.

(다음에서 상속됨 Component)
DesignMode

Component가 현재 디자인 모드인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
DisplayIndex

현재 표시된 열에 상대적인 열의 표시 순서를 가져오거나 설정합니다.

Events

Component에 연결된 이벤트 처리기의 목록을 가져옵니다.

(다음에서 상속됨 Component)
ImageIndex

ColumnHeader에 표시되는 이미지의 인덱스를 가져오거나 설정합니다.

ImageKey

열에 표시되는 이미지의 키를 가져오거나 설정합니다.

ImageList

ColumnHeader와 연결된 이미지 목록을 가져옵니다.

Index

이 열에 대한 ListView 컨트롤의 ListView.ColumnHeaderCollection이 있는 위치를 가져옵니다.

ListView

ListView가 위치하는 ColumnHeader 컨트롤을 가져옵니다.

Name

ColumnHeader의 이름을 가져오거나 설정합니다.

Site

ComponentISite를 가져오거나 설정합니다.

(다음에서 상속됨 Component)
Tag

ColumnHeader에 연결할 데이터가 포함된 개체를 가져오거나 설정합니다.

Text

열 머리글에 표시되는 텍스트를 가져오거나 설정합니다.

TextAlign

ColumnHeader에 표시되는 텍스트의 가로 맞춤을 가져오거나 설정합니다.

Width

열의 너비를 가져오거나 설정합니다.

메서드

AutoResize(ColumnHeaderAutoResizeStyle)

크기 조정 스타일에 지정된 대로 열 너비를 조정합니다.

Clone()

list view 컨트롤에 첨부되지 않은 현재 ColumnHeader의 복사본을 만듭니다.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

Component에서 사용하는 모든 리소스를 해제합니다.

(다음에서 상속됨 Component)
Dispose(Boolean)

ColumnHeader에서 사용하는 리소스(메모리 제외)를 삭제합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetService(Type)

Component 또는 해당 Container에서 제공하는 서비스를 나타내는 개체를 반환합니다.

(다음에서 상속됨 Component)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
ToString()

Component의 이름이 포함된 String을 반환합니다(있는 경우). 이 메서드는 재정의할 수 없습니다.

이벤트

Disposed

Dispose() 메서드를 호출하여 구성 요소를 삭제할 때 발생합니다.

(다음에서 상속됨 Component)

적용 대상

추가 정보