ImageList.Draw ImageList.Draw ImageList.Draw ImageList.Draw Method

정의

지정된 이미지를 그립니다.Draws the indicated image.

오버로드

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

지정된 Graphics의 지정된 인덱스에서 나타내는 이미지를 지정된 위치에 그립니다.Draws the image indicated by the specified index on the specified Graphics at the given location.

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

지정된 Graphics의 지정된 인덱스에서 나타내는 이미지를 지정된 위치에 그립니다.Draws the image indicated by the given index on the specified Graphics at the specified location.

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

지정된 Graphics의 지정된 인덱스에서 나타내는 이미지를 지정된 위치 및 크기를 사용하여 그립니다.Draws the image indicated by the given index on the specified Graphics using the specified location and size.

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

지정된 Graphics의 지정된 인덱스에서 나타내는 이미지를 지정된 위치에 그립니다.Draws the image indicated by the specified index on the specified Graphics at the given location.

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 Graphics Graphics

그릴 Graphics입니다.The Graphics to draw on.

pt
Point Point Point Point

해당 이미지를 그릴 위치이며 Point로 정의됩니다.The location defined by a Point at which to draw the image.

index
Int32 Int32 Int32 Int32

그릴 ImageList의 이미지 인덱스입니다.The index of the image in the ImageList to draw.

예외

인덱스가 0보다 작은 경우The index is less than 0.

또는-or-

인덱스가 이미지 목록의 이미지 개수보다 크거나 같은 경우The index is greater than or equal to the count of images in the image list.

예제

다음 코드 예제를 생성 하는 방법을 보여 줍니다는 ImageList, 이미지를 추가 합니다 Images 속성을 설정 합니다 ImageSize 속성을 사용 하 여를 Draw 메서드.The following code example demonstrates constructing an ImageList, adding images to the Images property, setting the ImageSize property, and using the Draw method. 이 예제를 실행 하려면 라는 단추가 포함 된 폼에 배치 Button1합니다.To run this example, place it in a form containing a button named Button1. 이 예제에서는 있다고 가정 FeatherTexture.bmp 하 고 Gone Fishing.bmp c:\Windows에\입니다.The example assumes the existence of FeatherTexture.bmp and Gone Fishing.bmp at c:\Windows\. 비트맵에 시스템에 존재 하지 않거나 다른 위치에 존재 하는 경우에 예제를 적절 하 게 변경 합니다.Change the example accordingly if the bitmaps do not exist on your system, or exist at another location.

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) Draw(Graphics, Int32, Int32, Int32) Draw(Graphics, Int32, Int32, Int32) Draw(Graphics, Int32, Int32, Int32)

지정된 Graphics의 지정된 인덱스에서 나타내는 이미지를 지정된 위치에 그립니다.Draws the image indicated by the given index on the specified Graphics at the specified location.

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 Graphics Graphics

그릴 Graphics입니다.The Graphics to draw on.

x
Int32 Int32 Int32 Int32

이미지를 그릴 가로 위치입니다.The horizontal position at which to draw the image.

y
Int32 Int32 Int32 Int32

이미지를 그릴 세로 위치입니다.The vertical position at which to draw the image.

index
Int32 Int32 Int32 Int32

그릴 ImageList의 이미지 인덱스입니다.The index of the image in the ImageList to draw.

예외

인덱스가 0보다 작은 경우The index is less than 0.

또는-or-

인덱스가 이미지 목록의 이미지 개수보다 크거나 같은 경우The index is greater than or equal to the count of images in the image list.

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

지정된 Graphics의 지정된 인덱스에서 나타내는 이미지를 지정된 위치 및 크기를 사용하여 그립니다.Draws the image indicated by the given index on the specified Graphics using the specified location and size.

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 Graphics Graphics

그릴 Graphics입니다.The Graphics to draw on.

x
Int32 Int32 Int32 Int32

이미지를 그릴 가로 위치입니다.The horizontal position at which to draw the image.

y
Int32 Int32 Int32 Int32

이미지를 그릴 세로 위치입니다.The vertical position at which to draw the image.

width
Int32 Int32 Int32 Int32

대상 이미지의 너비(픽셀)입니다.The width, in pixels, of the destination image.

height
Int32 Int32 Int32 Int32

대상 이미지의 높이(픽셀)입니다.The height, in pixels, of the destination image.

index
Int32 Int32 Int32 Int32

그릴 ImageList의 이미지 인덱스입니다.The index of the image in the ImageList to draw.

예외

인덱스가 0보다 작은 경우The index is less than 0.

또는-or-

인덱스가 이미지 목록의 이미지 개수보다 크거나 같은 경우The index is greater than or equal to the count of images in the image list.

설명

이미지 확장 되었거나 제공 된 경계에 맞게 필요에 따라 압축 됩니다.The image is stretched or compressed as necessary to fit the bounds provided.

적용 대상