ImageList 생성자

정의

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

오버로드

ImageList()

ImageList, ColorDepth 또는 ImageSize의 기본값을 사용하여 TransparentColor 클래스의 새 인스턴스를 초기화합니다.

ImageList(IContainer)

ImageList 클래스의 새 인스턴스를 초기화하여 컨테이너와 연결합니다.

ImageList()

ImageList, ColorDepth 또는 ImageSize의 기본값을 사용하여 TransparentColor 클래스의 새 인스턴스를 초기화합니다.

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

예제

다음 코드 예제를 생성 하는 방법을 ImageList보여 줍니다.는 , 속성에 Images 이미지를 추가, 설정 된 ImageSize 속성 및 사용 하 Draw 여 메서드. 이 예제를 실행하려면 라는 Button1단추가 포함된 양식에 배치합니다. 이 예제에서는 c:\Windows\에 및 Gone Fishing.bmpFeatherTexture.bmp 있다고 가정합니다. 비트맵이 시스템에 없거나 다른 위치에 있는 경우 이에 따라 예제를 변경합니다.

internal:
   System::Windows::Forms::ImageList^ ImageList1;

private:

   // Create an ImageList Object, populate it, and display
   // the images it contains.
   void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      
      // Construct the ImageList.
      ImageList1 = gcnew ImageList;
      
      // Set the ImageSize property to a larger size 
      // (the default is 16 x 16).
      ImageList1->ImageSize = System::Drawing::Size( 112, 112 );
      
      // Add two images to the list.
      ImageList1->Images->Add( Image::FromFile( "c:\\windows\\FeatherTexture.bmp" ) );
      ImageList1->Images->Add( Image::FromFile( "C:\\windows\\Gone Fishing.bmp" ) );
      
      // Get a Graphics object from the form's handle.
      Graphics^ theGraphics = Graphics::FromHwnd( this->Handle );
      
      // Loop through the images in the list, drawing each image.
      for ( int count = 0; count < ImageList1->Images->Count; count++ )
      {
         ImageList1->Draw( theGraphics, Point(85,85), count );
         
         // Call Application.DoEvents to force a repaint of the form.
         Application::DoEvents();
         
         // Call the Sleep method to allow the user to see the image.
         System::Threading::Thread::Sleep( 1000 );

      }
   }
internal System.Windows.Forms.ImageList ImageList1;

// Create an ImageList Object, populate it, and display
// the images it contains.
private void Button1_Click(System.Object sender, 
    System.EventArgs e)
{

    // Construct the ImageList.
    ImageList1 = new ImageList();

    // Set the ImageSize property to a larger size 
    // (the default is 16 x 16).
    ImageList1.ImageSize = new Size(112, 112);

    // Add two images to the list.
    ImageList1.Images.Add(
        Image.FromFile("c:\\windows\\FeatherTexture.bmp"));
    ImageList1.Images.Add(
        Image.FromFile("C:\\windows\\Gone Fishing.bmp"));

    // Get a Graphics object from the form's handle.
    Graphics theGraphics = Graphics.FromHwnd(this.Handle);

    // Loop through the images in the list, drawing each image.
    for(int count = 0; count < ImageList1.Images.Count; count++)
    {
        ImageList1.Draw(theGraphics, new Point(85, 85), count);

        // Call Application.DoEvents to force a repaint of the form.
        Application.DoEvents();

        // Call the Sleep method to allow the user to see the image.
        System.Threading.Thread.Sleep(1000);
    }
}
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList

' Create an ImageList Object, populate it, and display
' the images it contains.
Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click

    ' Construct the ImageList.
    ImageList1 = New ImageList

    ' Set the ImageSize property to a larger size 
    ' (the default is 16 x 16).
    ImageList1.ImageSize = New Size(112, 112)

    ' Add two images to the list.
    ImageList1.Images.Add(Image.FromFile _
        ("c:\windows\FeatherTexture.bmp"))
    ImageList1.Images.Add _
        (Image.FromFile("C:\windows\Gone Fishing.bmp"))

    Dim count As System.Int32

    ' Get a Graphics object from the form's handle.
    Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

    ' Loop through the images in the list, drawing each image.
    For count = 0 To ImageList1.Images.Count - 1
        ImageList1.Draw(theGraphics, New Point(85, 85), count)

        ' Call Application.DoEvents to force a repaint of the form.
        Application.DoEvents()

        ' Call the Sleep method to allow the user to see the image.
        System.Threading.Thread.Sleep(1000)
    Next
End Sub

설명

다음 표에서 인스턴스에 대 한 초기 속성 값을 보여 줍니다. ImageList합니다.

항목 Description
ColorDepth .NET 7을 통한 .NET Framework 및 .NET(Core) 버전에서 기본값은 입니다Depth8Bit. .NET 8 이상 버전에서 기본값은 입니다 Depth32Bit.
ImageSize 기본값은 Size 높이와 너비가 16 x 16인 개체입니다.
TransparentColor 기본값은 Transparent입니다.

적용 대상

ImageList(IContainer)

ImageList 클래스의 새 인스턴스를 초기화하여 컨테이너와 연결합니다.

public:
 ImageList(System::ComponentModel::IContainer ^ container);
public ImageList (System.ComponentModel.IContainer container);
new System.Windows.Forms.ImageList : System.ComponentModel.IContainer -> System.Windows.Forms.ImageList
Public Sub New (container As IContainer)

매개 변수

container
IContainer

IContainer 인스턴스와 연결할 ImageList를 구현하는 개체입니다.

설명

ImageList 생성자를 사용하면 를 개체와 연결할 ImageList 수 있습니다Container. 이와 같이 를 연결 ImageList 하면 의 ImageList 수명 제어를 에 전달합니다 Container. 이 기능은 애플리케이션에서 다양 한 구성 요소를 사용 하 고 모두 동시에 삭제 하려는 경우에 유용할 수 있습니다. 예를 들어 , 및 ContainerImageListTimer 를 와 연결ToolTip하면 컨테이너에서 를 호출 Dispose 하면 이러한 모든 구성 요소도 강제로 삭제됩니다.

적용 대상