다음을 통해 공유


ImageList.Draw 메서드

정의

표시된 이미지를 그립니다.

오버로드

Name Description
Draw(Graphics, Point, Int32)

지정된 위치에 지정된 인덱 Graphics 스로 표시된 이미지를 그립니다.

Draw(Graphics, Int32, Int32, Int32)

지정된 위치에 지정된 Graphics 인덱스로 표시된 이미지를 그립니다.

Draw(Graphics, Int32, Int32, Int32, Int32, Int32)

지정된 위치 및 크기를 사용하여 지정된 Graphics 인덱스로 표시된 이미지를 지정된 인덱스로 그립니다.

Draw(Graphics, Point, Int32)

Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs

지정된 위치에 지정된 인덱 Graphics 스로 표시된 이미지를 그립니다.

public:
 void Draw(System::Drawing::Graphics ^ g, System::Drawing::Point pt, int index);
public void Draw(System.Drawing.Graphics g, System.Drawing.Point pt, int index);
member this.Draw : System.Drawing.Graphics * System.Drawing.Point * int -> unit
Public Sub Draw (g As Graphics, pt As Point, index As Integer)

매개 변수

g
Graphics

Graphics 그릴 것입니다.

pt
Point

이미지를 그릴 위치에 정의된 Point 위치입니다.

index
Int32

그릴 이미지 ImageList 의 인덱스입니다.

예외

인덱스가 0보다 작습니다.

-또는-

인덱스가 이미지 목록의 이미지 수보다 크거나 같습니다.

예제

다음 코드 예제에서는 생성 하는 방법을 ImageList보여 줍니다., 속성에 Images 이미지를 추가, 속성을 설정 ImageSize 하 고 메서드를 Draw 사용 하 여 합니다. 이 예제를 실행하려면 이름이 인 Button1단추가 포함된 폼에 배치합니다. 이 예제에서는 c:\Windows\의 FeatherTexture.bmp 존재 여부에 Gone Fishing.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

적용 대상

Draw(Graphics, Int32, Int32, Int32)

Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs

지정된 위치에 지정된 Graphics 인덱스로 표시된 이미지를 그립니다.

public:
 void Draw(System::Drawing::Graphics ^ g, int x, int y, int index);
public void Draw(System.Drawing.Graphics g, int x, int y, int index);
member this.Draw : System.Drawing.Graphics * int * int * int -> unit
Public Sub Draw (g As Graphics, x As Integer, y As Integer, index As Integer)

매개 변수

g
Graphics

Graphics 그릴 것입니다.

x
Int32

이미지를 그릴 가로 위치입니다.

y
Int32

이미지를 그릴 세로 위치입니다.

index
Int32

그릴 이미지 ImageList 의 인덱스입니다.

예외

인덱스가 0보다 작습니다.

-또는-

인덱스가 이미지 목록의 이미지 수보다 크거나 같습니다.

적용 대상

Draw(Graphics, Int32, Int32, Int32, Int32, Int32)

Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs
Source:
ImageList.cs

지정된 위치 및 크기를 사용하여 지정된 Graphics 인덱스로 표시된 이미지를 지정된 인덱스로 그립니다.

public:
 void Draw(System::Drawing::Graphics ^ g, int x, int y, int width, int height, int index);
public void Draw(System.Drawing.Graphics g, int x, int y, int width, int height, int index);
member this.Draw : System.Drawing.Graphics * int * int * int * int * int -> unit
Public Sub Draw (g As Graphics, x As Integer, y As Integer, width As Integer, height As Integer, index As Integer)

매개 변수

g
Graphics

Graphics 그릴 것입니다.

x
Int32

이미지를 그릴 가로 위치입니다.

y
Int32

이미지를 그릴 세로 위치입니다.

width
Int32

대상 이미지의 너비(픽셀)입니다.

height
Int32

대상 이미지의 높이(픽셀)입니다.

index
Int32

그릴 이미지 ImageList 의 인덱스입니다.

예외

인덱스가 0보다 작습니다.

-또는-

인덱스가 이미지 목록의 이미지 수보다 크거나 같습니다.

설명

이미지는 제공된 범위에 맞게 필요에 따라 확장되거나 압축됩니다.

적용 대상