Graphics.DrawImage 메서드

정의

지정된 Image를 지정된 위치에 원래 크기로 그립니다.

오버로드

DrawImage(Image, Single, Single, RectangleF, GraphicsUnit)

이미지의 부분을 지정된 위치에 그립니다.

DrawImage(Image, Effect, RectangleF, Matrix, GraphicsUnit, ImageAttributes)
DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, IntPtr)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, IntPtr)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Int32, Int32, Int32, Int32)

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Single, Single, Single, Single)

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Effect)
DrawImage(Image, Point)

지정된 위치에 원래의 크기를 사용하여 특정 Image를 그립니다.

DrawImage(Image, Point[])

지정된 Image를 지정된 위치에 지정된 모양과 크기로 그립니다.

DrawImage(Image, PointF)

지정된 위치에 원래의 크기를 사용하여 특정 Image를 그립니다.

DrawImage(Image, PointF[])

지정된 Image를 지정된 위치에 지정된 모양과 크기로 그립니다.

DrawImage(Image, Rectangle)

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, RectangleF)

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Int32, Int32, Rectangle, GraphicsUnit)

이미지의 부분을 지정된 위치에 그립니다.

DrawImage(Image, Single, Single)

지정된 위치에 원래의 크기를 사용하여 특정 Image를 그립니다.

DrawImage(Image, Point[], Rectangle, GraphicsUnit)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, PointF[], RectangleF, GraphicsUnit)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Rectangle, Rectangle, GraphicsUnit)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, RectangleF, RectangleF, GraphicsUnit)

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

DrawImage(Image, Int32, Int32)

지정된 이미지를 좌표 쌍으로 지정된 위치에 원래 실제 크기로 그립니다.

DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes)

지정된 Image의 지정된 부분을 지정된 위치에 그립니다.

DrawImage(Image, Single, Single, RectangleF, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

이미지의 부분을 지정된 위치에 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, float x, float y, System::Drawing::RectangleF srcRect, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, float x, float y, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * single * single * System.Drawing.RectangleF * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, x As Single, y As Single, srcRect As RectangleF, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

x
Single

그려지는 이미지의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

y
Single

그려지는 이미지의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcRect
RectangleF

RectangleF 개체의 부분을 지정하는 Image 입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지의 왼쪽 위 모서리를 그릴 좌표를 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

원본 사각형의 크기에 따라 크기가 조정되지 않은 원본 이미지가 화면에 그려지는 부분이 결정됩니다.

public:
   void DrawImage2FloatRectF( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner of image.
      float x = 100.0F;
      float y = 100.0F;

      // Create rectangle for source image.
      RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, x, y, srcRect, units );
   }
public void DrawImage2FloatRectF(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create coordinates for upper-left corner of image.
    float x = 100.0F;
    float y = 100.0F;
             
    // Create rectangle for source image.
    RectangleF srcRect = new RectangleF(50.0F, 50.0F, 150.0F, 150.0F);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, srcRect, units);
}
Public Sub DrawImage2FloatRectF(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create coordinates for upper-left corner of image.
    Dim x As Single = 100.0F
    Dim y As Single = 100.0F

    ' Create rectangle for source image.
    Dim srcRect As New RectangleF(50.0F, 50.0F, 150.0F, 150.0F)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, srcRect, units)
End Sub

설명

Image 픽셀 너비의 값과 가로 해상도 값(인치당 점)을 저장합니다. 이미지의 실제 너비(인치 단위)는 픽셀 너비를 가로 해상도로 나눈 값입니다. 예를 들어 픽셀 너비가 360이고 가로 해상도가 인치당 72개인 이미지는 실제 너비가 5인치입니다. 픽셀 높이와 물리적 높이에 유사한 설명이 적용됩니다.

이 메서드는 실제 크기를 사용 하 여 이미지 부분을 인치 디스플레이 디바이스의 해상도 (인치당 도트 수)와 관계 없이 올바른 크기를 가집니다 이미지의 일부를 그립니다. 예를 들어 이미지 부분에 픽셀 너비가 216이고 가로 해상도가 인치당 72도트라고 가정합니다. 부분 렌더링된 이미지의 픽셀 너비 (216/72) 부분을 그릴 이미지 96dpi 해상도 포함 하는 디바이스에서이 메서드를 호출 하면 수 * 96 = 288 개.

추가 정보

적용 대상

DrawImage(Image, Effect, RectangleF, Matrix, GraphicsUnit, ImageAttributes)

Source:
Graphics.cs
public void DrawImage (System.Drawing.Image image, System.Drawing.Imaging.Effects.Effect effect, System.Drawing.RectangleF srcRect = default, System.Drawing.Drawing2D.Matrix? transform = default, System.Drawing.GraphicsUnit srcUnit = System.Drawing.GraphicsUnit.Pixel, System.Drawing.Imaging.ImageAttributes? imageAttr = default);
member this.DrawImage : System.Drawing.Image * System.Drawing.Imaging.Effects.Effect * System.Drawing.RectangleF * System.Drawing.Drawing2D.Matrix * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes -> unit
Public Sub DrawImage (image As Image, effect As Effect, Optional srcRect As RectangleF = Nothing, Optional transform As Matrix = Nothing, Optional srcUnit As GraphicsUnit = System.Drawing.GraphicsUnit.Pixel, Optional imageAttr As ImageAttributes = Nothing)

매개 변수

image
Image
effect
Effect
srcRect
RectangleF
transform
Matrix
srcUnit
GraphicsUnit
imageAttr
ImageAttributes

적용 대상

DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::Point> ^ destPoints, System::Drawing::Rectangle srcRect, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr, System::Drawing::Graphics::DrawImageAbort ^ callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr, System.Drawing.Graphics.DrawImageAbort? callback);
member this.DrawImage : System.Drawing.Image * System.Drawing.Point[] * System.Drawing.Rectangle * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort -> unit
Public Sub DrawImage (image As Image, destPoints As Point(), srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttr As ImageAttributes, callback As Graphics.DrawImageAbort)

매개 변수

image
Image

그릴 Image입니다.

destPoints
Point[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

srcRect
Rectangle

그릴 image 개체의 부분을 지정하는 Rectangle 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 단지 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트합니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 그릴 이미지의 부분을 선택하는 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 병렬 프로그래밍을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

원래의 조정되지 않은 병렬 도형의 경우 위치는 화면에서 이미지를 찾고 사각형의 크기와 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

이 예제에서는 매개 변수를 전달 callBackData 하지 않는 오버로드를 사용하므로 콜백은 메서드가 DrawImage 종료되도록 하는 를 반환true하고 예제에 포함된 예외 처리 코드는 이미지를 그리는 대신 예외 텍스트를 출력 Graphics.DrawImageAbort 합니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback1( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageParaRectAttribAbort( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback1 );

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing original image.
      Point ulCorner = Point(100,100);
      Point urCorner = Point(550,100);
      Point llCorner = Point(150,250);
      array<Point>^ destPara1 = {ulCorner,urCorner,llCorner};

      // Create rectangle for source image.
      Rectangle srcRect = Rectangle(50,50,150,150);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destPara1, srcRect, units );

      // Create parallelogram for drawing adjusted image.
      Point ulCorner2 = Point(325,100);
      Point urCorner2 = Point(550,100);
      Point llCorner2 = Point(375,250);
      array<Point>^ destPara2 = {ulCorner2,urCorner2,llCorner2};

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw image to screen.
         e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback1(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageParaRectAttribAbort(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback1);
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing original image.
    Point ulCorner = new Point(100, 100);
    Point urCorner = new Point(550, 100);
    Point llCorner = new Point(150, 250);
    Point[] destPara1 = {ulCorner, urCorner, llCorner};
             
    // Create rectangle for source image.
    Rectangle srcRect = new Rectangle(50, 50, 150, 150);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units);
             
    // Create parallelogram for drawing adjusted image.
    Point ulCorner2 = new Point(325, 100);
    Point urCorner2 = new Point(550, 100);
    Point llCorner2 = new Point(375, 250);
    Point[] destPara2 = {ulCorner2, urCorner2, llCorner2};
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw image to screen.
            e.Graphics.DrawImage(
                newImage,
                destPara2,
                srcRect,
                units,
                imageAttr,
                imageCallback);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback1(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageParaRectAttribAbort(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback1)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing original image.
    Dim ulCorner As New Point(100, 100)
    Dim urCorner As New Point(550, 100)
    Dim llCorner As New Point(150, 250)
    Dim destPara1 As Point() = {ulCorner, urCorner, llCorner}

    ' Create rectangle for source image.
    Dim srcRect As New Rectangle(50, 50, 150, 150)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units)

    ' Create parallelogram for drawing adjusted image.
    Dim ulCorner2 As New Point(325, 100)
    Dim urCorner2 As New Point(550, 100)
    Dim llCorner2 As New Point(375, 250)
    Dim destPara2 As Point() = {ulCorner2, urCorner2, llCorner2}

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw image to screen.
        e.Graphics.DrawImage(newImage, destPara2, srcRect, units, _
        imageAttr, imageCallback)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 병렬 프로그래밍 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

이 오버 로드는 callback 매개 변수는 애플리케이션에 의해 결정 된 조건에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr, System::Drawing::Graphics::DrawImageAbort ^ callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr, System.Drawing.Graphics.DrawImageAbort? callback);
member this.DrawImage : System.Drawing.Image * System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort -> unit
Public Sub DrawImage (image As Image, destPoints As PointF(), srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttr As ImageAttributes, callback As Graphics.DrawImageAbort)

매개 변수

image
Image

그릴 Image입니다.

destPoints
PointF[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

srcRect
RectangleF

그릴 image 개체의 부분을 지정하는 RectangleF 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트하기만 하면 됩니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 그릴 이미지 부분을 선택하는 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 병렬 프로그래밍을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

원래의 조정되지 않은 병렬 도형의 경우 위치는 화면에서 이미지를 찾고 사각형의 크기와 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

이 예제에서는 매개 변수를 전달 callBackData 하지 않는 오버로드를 사용하므로 콜백은 메서드가 DrawImage 종료되도록 하는 를 반환true하고 예제에 포함된 예외 처리 코드는 이미지를 그리는 대신 예외 텍스트를 출력 Graphics.DrawImageAbort 합니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback3( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageParaFRectAttribAbort( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback3 );

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing original image.
      PointF ulCorner1 = PointF(100.0F,100.0F);
      PointF urCorner1 = PointF(325.0F,100.0F);
      PointF llCorner1 = PointF(150.0F,250.0F);
      array<PointF>^ destPara1 = {ulCorner1,urCorner1,llCorner1};

      // Create rectangle for source image.
      RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Create parallelogram for drawing adjusted image.
      PointF ulCorner2 = PointF(325.0F,100.0F);
      PointF urCorner2 = PointF(550.0F,100.0F);
      PointF llCorner2 = PointF(375.0F,250.0F);
      array<PointF>^ destPara2 = {ulCorner2,urCorner2,llCorner2};

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destPara1, srcRect, units );

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw adjusted image to screen.
         e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback3(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageParaFRectAttribAbort(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback3);
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing original image.
    PointF ulCorner1 = new PointF(100.0F, 100.0F);
    PointF urCorner1 = new PointF(325.0F, 100.0F);
    PointF llCorner1 = new PointF(150.0F, 250.0F);
    PointF[] destPara1 = {ulCorner1, urCorner1, llCorner1};
             
    // Create rectangle for source image.
    RectangleF srcRect = new RectangleF(50.0F, 50.0F, 150.0F, 150.0F);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Create parallelogram for drawing adjusted image.
    PointF ulCorner2 = new PointF(325.0F, 100.0F);
    PointF urCorner2 = new PointF(550.0F, 100.0F);
    PointF llCorner2 = new PointF(375.0F, 250.0F);
    PointF[] destPara2 = {ulCorner2, urCorner2, llCorner2};
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw adjusted image to screen.
            e.Graphics.DrawImage(
                newImage,
                destPara2,
                srcRect,
                units,
                imageAttr,
                imageCallback);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback3(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageParaFRectAttribAbort(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback3)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing original image.
    Dim ulCorner1 As New PointF(100.0F, 100.0F)
    Dim urCorner1 As New PointF(325.0F, 100.0F)
    Dim llCorner1 As New PointF(150.0F, 250.0F)
    Dim destPara1 As PointF() = {ulCorner1, urCorner1, llCorner1}

    ' Create rectangle for source image.
    Dim srcRect As New RectangleF(50.0F, 50.0F, 150.0F, 150.0F)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Create parallelogram for drawing adjusted image.
    Dim ulCorner2 As New PointF(325.0F, 100.0F)
    Dim urCorner2 As New PointF(550.0F, 100.0F)
    Dim llCorner2 As New PointF(375.0F, 250.0F)
    Dim destPara2 As PointF() = {ulCorner2, urCorner2, llCorner2}

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw adjusted image to screen.
        e.Graphics.DrawImage(newImage, destPara2, srcRect, units, _
        imageAttr, imageCallback)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 병렬 프로그래밍 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

이 오버 로드는 callback 매개 변수는 애플리케이션에 의해 결정 된 조건에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::Point> ^ destPoints, System::Drawing::Rectangle srcRect, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr, System::Drawing::Graphics::DrawImageAbort ^ callback, int callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr, System.Drawing.Graphics.DrawImageAbort? callback, int callbackData);
member this.DrawImage : System.Drawing.Image * System.Drawing.Point[] * System.Drawing.Rectangle * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort * int -> unit
Public Sub DrawImage (image As Image, destPoints As Point(), srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttr As ImageAttributes, callback As Graphics.DrawImageAbort, callbackData As Integer)

매개 변수

image
Image

그릴 Image입니다.

destPoints
Point[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

srcRect
Rectangle

그릴 image 개체의 부분을 지정하는 Rectangle 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

callbackData
Int32

DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32) 메서드의 실행을 중지할지 여부를 확인할 때 사용하기 위한 Graphics.DrawImageAbort 대리자의 추가 데이터를 지정하는 값입니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트하기만 하면 됩니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 그릴 이미지 부분을 선택하는 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 병렬 프로그래밍을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

원래의 조정되지 않은 병렬 도형의 경우 위치는 화면에서 이미지를 찾고 사각형의 크기와 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

이 예제에서는 매개 변수 Graphics.DrawImageAbort 를 전달하는 오버로드를 callBackData 사용하므로 콜백은 를 반환false하여 메서드가 DrawImage 계속되도록 하고, 이 예제에서는 조정된 이미지를 화면에 그립니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback2( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageParaRectAttribAbortData( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback2 );
      int imageCallbackData = 1;

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing original image.
      Point ulCorner = Point(100,100);
      Point urCorner = Point(550,100);
      Point llCorner = Point(150,250);
      array<Point>^ destPara1 = {ulCorner,urCorner,llCorner};

      // Create rectangle for source image.
      Rectangle srcRect = Rectangle(50,50,150,150);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destPara1, srcRect, units );

      // Create parallelogram for drawing adjusted image.
      Point ulCorner2 = Point(325,100);
      Point urCorner2 = Point(550,100);
      Point llCorner2 = Point(375,250);
      array<Point>^ destPara2 = {ulCorner2,urCorner2,llCorner2};

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw image to screen.
         e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback, imageCallbackData );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback2(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageParaRectAttribAbortData(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback2);
    int imageCallbackData = 1;
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing original image.
    Point ulCorner = new Point(100, 100);
    Point urCorner = new Point(550, 100);
    Point llCorner = new Point(150, 250);
    Point[] destPara1 = {ulCorner, urCorner, llCorner};
             
    // Create rectangle for source image.
    Rectangle srcRect = new Rectangle(50, 50, 150, 150);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units);
             
    // Create parallelogram for drawing adjusted image.
    Point ulCorner2 = new Point(325, 100);
    Point urCorner2 = new Point(550, 100);
    Point llCorner2 = new Point(375, 250);
    Point[] destPara2 = {ulCorner2, urCorner2, llCorner2};
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw image to screen.
            e.Graphics.DrawImage(
                newImage,
                destPara2,
                srcRect,
                units,
                imageAttr,
                imageCallback,
                imageCallbackData);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback2(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageParaRectAttribAbortData(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback2)
    Dim imageCallbackData As Integer = 1

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing original image.
    Dim ulCorner As New Point(100, 100)
    Dim urCorner As New Point(550, 100)
    Dim llCorner As New Point(150, 250)
    Dim destPara1 As Point() = {ulCorner, urCorner, llCorner}

    ' Create rectangle for source image.
    Dim srcRect As New Rectangle(50, 50, 150, 150)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units)

    ' Create parallelogram for drawing adjusted image.
    Dim ulCorner2 As New Point(325, 100)
    Dim urCorner2 As New Point(550, 100)
    Dim llCorner2 As New Point(375, 250)
    Dim destPara2 As Point() = {ulCorner2, urCorner2, llCorner2}

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw image to screen.
        e.Graphics.DrawImage(newImage, destPara2, srcRect, units, _
        imageAttr, imageCallback, imageCallbackData)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 병렬 프로그래밍 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

이 오버 로드 된 callbackcallbackData 매개 변수는 조건 및 애플리케이션에 의해 결정 되는 데이터에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr, System::Drawing::Graphics::DrawImageAbort ^ callback, int callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr, System.Drawing.Graphics.DrawImageAbort? callback, int callbackData);
member this.DrawImage : System.Drawing.Image * System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort * int -> unit
Public Sub DrawImage (image As Image, destPoints As PointF(), srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttr As ImageAttributes, callback As Graphics.DrawImageAbort, callbackData As Integer)

매개 변수

image
Image

그릴 Image입니다.

destPoints
PointF[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

srcRect
RectangleF

그릴 image 개체의 부분을 지정하는 RectangleF 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

callbackData
Int32

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, Int32) 메서드의 실행을 중지할지 여부를 확인할 때 사용하기 위한 Graphics.DrawImageAbort 대리자의 추가 데이터를 지정하는 값입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 매개 변수PaintPa인 가 필요합니다PaintEventArgse. 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트하기만 하면 됩니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 그릴 이미지 부분을 선택하는 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 병렬 프로그래밍을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

원래의 조정되지 않은 병렬 도형의 경우 위치는 화면에서 이미지를 찾고 사각형의 크기와 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

이 예제에서는 매개 변수 Graphics.DrawImageAbort 를 전달하는 오버로드를 callBackData 사용하므로 콜백은 를 반환false하여 메서드가 DrawImage 계속되도록 하고, 이 예제에서는 조정된 이미지를 화면에 그립니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback4( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageParaFRectAttribAbortData( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback4 );
      int imageCallbackData = 1;

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing original image.
      PointF ulCorner1 = PointF(100.0F,100.0F);
      PointF urCorner1 = PointF(325.0F,100.0F);
      PointF llCorner1 = PointF(150.0F,250.0F);
      array<PointF>^ destPara1 = {ulCorner1,urCorner1,llCorner1};

      // Create rectangle for source image.
      RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Create parallelogram for drawing adjusted image.
      PointF ulCorner2 = PointF(325.0F,100.0F);
      PointF urCorner2 = PointF(550.0F,100.0F);
      PointF llCorner2 = PointF(375.0F,250.0F);
      array<PointF>^ destPara2 = {ulCorner2,urCorner2,llCorner2};

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destPara1, srcRect, units );

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw adjusted image to screen.
         e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback, imageCallbackData );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback4(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageParaFRectAttribAbortData(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback4);
    int imageCallbackData = 1;
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing original image.
    PointF ulCorner1 = new PointF(100.0F, 100.0F);
    PointF urCorner1 = new PointF(325.0F, 100.0F);
    PointF llCorner1 = new PointF(150.0F, 250.0F);
    PointF[] destPara1 = {ulCorner1, urCorner1, llCorner1};
             
    // Create rectangle for source image.
    RectangleF srcRect = new RectangleF(50.0F, 50.0F, 150.0F, 150.0F);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Create parallelogram for drawing adjusted image.
    PointF ulCorner2 = new PointF(325.0F, 100.0F);
    PointF urCorner2 = new PointF(550.0F, 100.0F);
    PointF llCorner2 = new PointF(375.0F, 250.0F);
    PointF[] destPara2 = {ulCorner2, urCorner2, llCorner2};
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw adjusted image to screen.
            e.Graphics.DrawImage(
                newImage,
                destPara2,
                srcRect,
                units,
                imageAttr,
                imageCallback,
                imageCallbackData);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback4(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageParaFRectAttribAbortData(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback4)
    Dim imageCallbackData As Integer = 1

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing original image.
    Dim ulCorner1 As New PointF(100.0F, 100.0F)
    Dim urCorner1 As New PointF(325.0F, 100.0F)
    Dim llCorner1 As New PointF(150.0F, 250.0F)
    Dim destPara1 As PointF() = {ulCorner1, urCorner1, llCorner1}

    ' Create rectangle for source image.
    Dim srcRect As New RectangleF(50.0F, 50.0F, 150.0F, 150.0F)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Create parallelogram for drawing adjusted image.
    Dim ulCorner2 As New PointF(325.0F, 100.0F)
    Dim urCorner2 As New PointF(550.0F, 100.0F)
    Dim llCorner2 As New PointF(375.0F, 250.0F)
    Dim destPara2 As PointF() = {ulCorner2, urCorner2, llCorner2}

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw adjusted image to screen.
        e.Graphics.DrawImage(newImage, destPara2, srcRect, units, _
        imageAttr, imageCallback, imageCallbackData)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 parallelogram 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

이 오버 로드 된 callbackcallbackData 매개 변수는 조건 및 애플리케이션에 의해 결정 되는 데이터에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * int * int * int * int * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Integer, srcY As Integer, srcWidth As Integer, srcHeight As Integer, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Int32

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Int32

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Int32

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Int32

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형의 좌표를 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

대상 사각형의 위치는 화면에서 이미지를 찾고 원본 및 대상 사각형의 크기에 따라 그려진 이미지의 크기가 결정되고 원본 사각형의 크기에 따라 원래 이미지가 화면에 그려지는 부분이 결정됩니다.

void DrawImageRect4Int( PaintEventArgs^ e )
{
   // Create image.
   Image^ newImage = Image::FromFile( "SampImag.jpg" );

   // Create rectangle for displaying image.
   Rectangle destRect = Rectangle(100,100,450,150);

   // Create coordinates of rectangle for source image.
   int x = 50;
   int y = 50;
   int width = 150;
   int height = 150;
   GraphicsUnit units = GraphicsUnit::Pixel;

   // Draw image to screen.
   e->Graphics->DrawImage( newImage, destRect, x, y, width, height, units );
}
private void DrawImageRect4Int(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying image.
    Rectangle destRect = new Rectangle(100, 100, 450, 150);
             
    // Create coordinates of rectangle for source image.
    int x = 50;
    int y = 50;
    int width = 150;
    int height = 150;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, x, y, width, height, units);
}
Private Sub DrawImageRect4Int(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying image.
    Dim destRect As New Rectangle(100, 100, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Integer = 50
    Dim y As Integer = 50
    Dim width As Integer = 150
    Dim height As Integer = 150
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, x, y, width, height, _
    units)
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * int * int * int * int * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Integer, srcY As Integer, srcWidth As Integer, srcHeight As Integer, srcUnit As GraphicsUnit, imageAttr As ImageAttributes)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Int32

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Int32

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Int32

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Int32

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형의 좌표를 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 사각형을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 사각형의 경우 위치는 화면에서 이미지를 찾고 원본 및 대상 사각형의 크기에 따라 그려진 이미지의 크기가 결정되고 원본 사각형의 크기에 따라 원래 이미지가 화면에 그려지는 부분이 결정됩니다.

void DrawImageRect4IntAtrrib( PaintEventArgs^ e )
{
   // Create image.
   Image^ newImage = Image::FromFile( "SampImag.jpg" );

   // Create rectangle for displaying original image.
   Rectangle destRect1 = Rectangle(100,25,450,150);

   // Create coordinates of rectangle for source image.
   int x = 50;
   int y = 50;
   int width = 150;
   int height = 150;
   GraphicsUnit units = GraphicsUnit::Pixel;

   // Draw original image to screen.
   e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units );

   // Create rectangle for adjusted image.
   Rectangle destRect2 = Rectangle(100,175,450,150);

   // Create image attributes and set large gamma.
   ImageAttributes^ imageAttr = gcnew ImageAttributes;
   imageAttr->SetGamma( 4.0F );

   // Draw adjusted image to screen.
   e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr );
}
private void DrawImageRect4IntAtrrib(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying original image.
    Rectangle destRect1 = new Rectangle(100, 25, 450, 150);
             
    // Create coordinates of rectangle for source image.
    int x = 50;
    int y = 50;
    int width = 150;
    int height = 150;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
             
    // Create rectangle for adjusted image.
    Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
             
    // Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destRect2, x, y, width, height, units, imageAttr);
}
Private Sub DrawImageRect4IntAtrrib(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying original image.
    Dim destRect1 As New Rectangle(100, 25, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Integer = 50
    Dim y As Integer = 50
    Dim width As Integer = 150
    Dim height As Integer = 150
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, _
    units)

    ' Create rectangle for adjusted image.
    Dim destRect2 As New Rectangle(100, 175, 450, 150)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)

    ' Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destRect2, x, y, width, height, _
    units, imageAttr)
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttrs);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttrs);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * single * single * single * single * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Single, srcY As Single, srcWidth As Single, srcHeight As Single, srcUnit As GraphicsUnit, imageAttrs As ImageAttributes)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Single

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Single

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Single

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Single

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttrs
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형의 좌표를 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 사각형을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 사각형의 경우 위치는 화면에서 이미지를 찾고 원본 및 대상 사각형의 크기에 따라 그려진 이미지의 크기가 결정되고 원본 사각형의 크기에 따라 원래 이미지가 화면에 그려지는 부분이 결정됩니다.

private:
   void DrawImageRect4FloatAttrib( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying original image.
      Rectangle destRect1 = Rectangle(100,25,450,150);

      // Create coordinates of rectangle for source image.
      float x = 50.0F;
      float y = 50.0F;
      float width = 150.0F;
      float height = 150.0F;
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units );

      // Create rectangle for adjusted image.
      Rectangle destRect2 = Rectangle(100,175,450,150);

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );

      // Draw adjusted image to screen.
      e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr );
   }
private void DrawImageRect4FloatAttrib(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying original image.
    Rectangle destRect1 = new Rectangle(100, 25, 450, 150);
             
    // Create coordinates of rectangle for source image.
    float x = 50.0F;
    float y = 50.0F;
    float width = 150.0F;
    float height = 150.0F;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
             
    // Create rectangle for adjusted image.
    Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
             
    // Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destRect2, x, y, width, height, units, imageAttr);
}
Private Sub DrawImageRect4FloatAttrib(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying original image.
    Dim destRect1 As New Rectangle(100, 25, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Single = 50.0F
    Dim y As Single = 50.0F
    Dim width As Single = 150.0F
    Dim height As Single = 150.0F
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, _
    height, units)

    ' Create rectangle for adjusted image.
    Dim destRect2 As New Rectangle(100, 175, 450, 150)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)

    ' Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destRect2, x, y, width, height, _
    units, imageAttr)
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr, System::Drawing::Graphics::DrawImageAbort ^ callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr, System.Drawing.Graphics.DrawImageAbort? callback);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * int * int * int * int * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Integer, srcY As Integer, srcWidth As Integer, srcHeight As Integer, srcUnit As GraphicsUnit, imageAttr As ImageAttributes, callback As Graphics.DrawImageAbort)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Int32

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Int32

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Int32

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Int32

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 단지 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트합니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 정의하는 점을 만듭니다.

  • 그릴 이미지의 부분을 선택하는 원본 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 대상 사각형을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 사각형의 경우 위치는 화면에서 이미지를 찾고 원본 사각형의 크기와 대상 사각형의 크기와 모양에 따라 그려진 이미지의 크기 조정이 결정됩니다.

이 예제에서는 매개 변수를 전달 callBackData 하지 않는 오버로드를 사용하므로 콜백은 를 반환true하여 DrawImage 메서드를 종료하고 예제에 포함된 예외 처리 코드는 이미지를 그리는 대신 예외 텍스트를 출력 Graphics.DrawImageAbort 합니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback5( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageRect4IntAtrribAbort( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback5 );

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying original image.
      Rectangle destRect1 = Rectangle(100,25,450,150);

      // Create coordinates of rectangle for source image.
      int x = 50;
      int y = 50;
      int width = 150;
      int height = 150;
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units );

      // Create rectangle for adjusted image.
      Rectangle destRect2 = Rectangle(100,175,450,150);

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw adjusted image to screen.
         e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback5(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageRect4IntAtrribAbort(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback5);
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying original image.
    Rectangle destRect1 = new Rectangle(100, 25, 450, 150);
             
    // Create coordinates of rectangle for source image.
    int x = 50;
    int y = 50;
    int width = 150;
    int height = 150;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
             
    // Create rectangle for adjusted image.
    Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw adjusted image to screen.
            e.Graphics.DrawImage(
                newImage,
                destRect2,
                x, y,
                width, height,
                units,
                imageAttr,
                imageCallback);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback5(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageRect4IntAtrribAbort(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback5)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying original image.
    Dim destRect1 As New Rectangle(100, 25, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Integer = 50
    Dim y As Integer = 50
    Dim width As Integer = 150
    Dim height As Integer = 150
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, _
    units)

    ' Create rectangle for adjusted image.
    Dim destRect2 As New Rectangle(100, 175, 450, 150)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw adjusted image to screen.
        e.Graphics.DrawImage(newImage, destRect2, x, y, width, _
        height, units, imageAttr, imageCallback)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 개체가 지정한 사각형 내부에 맞게 크기가 destRect 조정됩니다.

이 오버 로드는 callback 매개 변수는 애플리케이션에 의해 결정 된 조건에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttrs, System::Drawing::Graphics::DrawImageAbort ^ callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttrs, System.Drawing.Graphics.DrawImageAbort? callback);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * single * single * single * single * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Single, srcY As Single, srcWidth As Single, srcHeight As Single, srcUnit As GraphicsUnit, imageAttrs As ImageAttributes, callback As Graphics.DrawImageAbort)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Single

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Single

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Single

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Single

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttrs
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 단지 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트합니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 정의하는 점을 만듭니다.

  • 그릴 이미지의 부분을 선택하는 원본 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 대상 사각형을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 사각형의 경우 위치는 화면에서 이미지를 찾고 원본 사각형의 크기와 대상 사각형의 크기와 모양에 따라 그려진 이미지의 크기 조정이 결정됩니다.

이 예제에서는 매개 변수를 전달 callBackData 하지 않는 오버로드를 사용하므로 콜백은 를 반환true하여 DrawImage 메서드를 종료하고 예제에 포함된 예외 처리 코드는 이미지를 그리는 대신 예외 텍스트를 출력 Graphics.DrawImageAbort 합니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback7( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageRect4FloatAttribAbort( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback7 );

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying original image.
      Rectangle destRect1 = Rectangle(100,25,450,150);

      // Create coordinates of rectangle for source image.
      float x = 50.0F;
      float y = 50.0F;
      float width = 150.0F;
      float height = 150.0F;
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units );

      // Create rectangle for adjusted image.
      Rectangle destRect2 = Rectangle(100,175,450,150);

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw adjusted image to screen.
         e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback7(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageRect4FloatAttribAbort(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback7);
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying original image.
    Rectangle destRect1 = new Rectangle(100, 25, 450, 150);
             
    // Create coordinates of rectangle for source image.
    float x = 50.0F;
    float y = 50.0F;
    float width = 150.0F;
    float height = 150.0F;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
             
    // Create rectangle for adjusted image.
    Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw adjusted image to screen.
            e.Graphics.DrawImage(
                newImage,
                destRect2,
                x, y,
                width, height,
                units,
                imageAttr,
                imageCallback);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback7(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageRect4FloatAttribAbort(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback7)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying original image.
    Dim destRect1 As New Rectangle(100, 25, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Single = 50.0F
    Dim y As Single = 50.0F
    Dim width As Single = 150.0F
    Dim height As Single = 150.0F
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, _
    height, units)

    ' Create rectangle for adjusted image.
    Dim destRect2 As New Rectangle(100, 175, 450, 150)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw adjusted image to screen.
        e.Graphics.DrawImage(newImage, destRect2, x, y, width, _
        height, units, imageAttr, imageCallback)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

이 오버 로드는 callback 매개 변수는 애플리케이션에 의해 결정 된 조건에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, IntPtr)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttrs, System::Drawing::Graphics::DrawImageAbort ^ callback, IntPtr callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, IntPtr callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttrs, System.Drawing.Graphics.DrawImageAbort? callback, IntPtr callbackData);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * int * int * int * int * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort * nativeint -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Integer, srcY As Integer, srcWidth As Integer, srcHeight As Integer, srcUnit As GraphicsUnit, imageAttrs As ImageAttributes, callback As Graphics.DrawImageAbort, callbackData As IntPtr)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Int32

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Int32

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Int32

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Int32

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttrs
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, Rectangle, Int32, Int32, Int32, Int32, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, IntPtr) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

callbackData
IntPtr

nativeint

DrawImage 메서드의 실행을 중지할지 여부를 확인할 때 사용하기 위한 Graphics.DrawImageAbort 대리자의 추가 데이터를 지정하는 값입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 단지 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트합니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 정의하는 점을 만듭니다.

  • 그릴 이미지의 부분을 선택하는 원본 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 대상 사각형을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 사각형의 경우 위치는 화면에서 이미지를 찾고 원본 사각형의 크기와 대상 사각형의 크기와 모양에 따라 그려진 이미지의 크기 조정이 결정됩니다.

이 예제에서는 매개 변수 Graphics.DrawImageAbort 를 전달하는 오버로드를 callBackData 사용하므로 콜백은 를 반환false하므로 메서드가 DrawImage 계속 진행되고 이 예제에서는 조정된 이미지를 화면에 그립니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback6( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

private:
   void DrawImageRect4IntAtrribAbortData( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback6 );
      IntPtr imageCallbackData = IntPtr(1);

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying original image.
      Rectangle destRect1 = Rectangle(100,25,450,150);

      // Create coordinates of rectangle for source image.
      int x = 50;
      int y = 50;
      int width = 150;
      int height = 150;
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units );

      // Create rectangle for adjusted image.
      Rectangle destRect2 = Rectangle(100,175,450,150);

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );
      try
      {
         // Draw adjusted image to screen.
         e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback, imageCallbackData );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback6(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
private void DrawImageRect4IntAtrribAbortData(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback6);
    IntPtr imageCallbackData = new IntPtr(1);
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying original image.
    Rectangle destRect1 = new Rectangle(100, 25, 450, 150);
             
    // Create coordinates of rectangle for source image.
    int x = 50;
    int y = 50;
    int width = 150;
    int height = 150;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
             
    // Create rectangle for adjusted image.
    Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
    try
    {
        checked
        {
             
            // Draw adjusted image to screen.
            e.Graphics.DrawImage(
                newImage,
                destRect2,
                x, y,
                width, height,
                units,
                imageAttr,
                imageCallback,
                imageCallbackData);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback6(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Private Sub DrawImageRect4IntAtrribAbortData(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback6)
    Dim imageCallbackData As New IntPtr(1)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying original image.
    Dim destRect1 As New Rectangle(100, 25, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Integer = 50
    Dim y As Integer = 50
    Dim width As Integer = 150
    Dim height As Integer = 150
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, _
    units)

    ' Create rectangle for adjusted image.
    Dim destRect2 As New Rectangle(100, 175, 450, 150)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)
    Try

        ' Draw adjusted image to screen.
        e.Graphics.DrawImage(newImage, destRect2, x, y, width, _
        height, units, imageAttr, imageCallback, imageCallbackData)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

이 오버 로드 된 callbackcallbackData 매개 변수는 조건 및 애플리케이션에 의해 결정 되는 데이터에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, IntPtr)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttrs, System::Drawing::Graphics::DrawImageAbort ^ callback, IntPtr callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, IntPtr callbackData);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttrs, System.Drawing.Graphics.DrawImageAbort? callback, IntPtr callbackData);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * single * single * single * single * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes * System.Drawing.Graphics.DrawImageAbort * nativeint -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Single, srcY As Single, srcWidth As Single, srcHeight As Single, srcUnit As GraphicsUnit, imageAttrs As ImageAttributes, callback As Graphics.DrawImageAbort, callbackData As IntPtr)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Single

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Single

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Single

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Single

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttrs
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

callback
Graphics.DrawImageAbort

이미지를 그리는 동안 호출할 메서드를 지정하는 Graphics.DrawImageAbort 대리자입니다. 이 메서드는 애플리케이션에 의해 결정된 조건에 따라 DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit, ImageAttributes, Graphics+DrawImageAbort, IntPtr) 메서드의 실행을 중지할지 여부를 확인하기 위해 자주 호출됩니다.

callbackData
IntPtr

nativeint

DrawImage 메서드의 실행을 중지할지 여부를 확인할 때 사용하기 위한 Graphics.DrawImageAbort 대리자의 추가 데이터를 지정하는 값입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 먼저 대리자의 콜백 메서드를 Graphics.DrawImageAbort 정의합니다. 정의는 단순하며 단지 메서드가 null callBackData 매개 변수를 사용하여 호출하는지 여부를 DrawImage 테스트합니다. 예제의 기본 본문은 다음 작업을 수행합니다.

  • 콜백 메서드의 Graphics.DrawImageAbort instance 만듭니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 정의하는 점을 만듭니다.

  • 그릴 이미지의 부분을 선택하는 원본 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 대상 사각형을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 사각형의 경우 위치는 화면에서 이미지를 찾고 원본 사각형의 크기와 대상 사각형의 크기와 모양에 따라 그려진 이미지의 크기 조정이 결정됩니다.

이 예제에서는 매개 변수 Graphics.DrawImageAbort 를 전달하는 오버로드를 callBackData 사용하므로 콜백은 를 반환false하므로 메서드가 DrawImage 계속 진행되고 이 예제에서는 조정된 이미지를 화면에 그립니다.

   // Define DrawImageAbort callback method.
private:
   bool DrawImageCallback8( IntPtr callBackData )
   {
      // Test for call that passes callBackData parameter.
      if ( callBackData == IntPtr::Zero )
      {
         
         // If no callBackData passed, abort DrawImage method.
         return true;
      }
      else
      {
         
         // If callBackData passed, continue DrawImage method.
         return false;
      }
   }

public:
   void DrawImageRect4FloatAttribAbortData( PaintEventArgs^ e )
   {
      // Create callback method.
      Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback8 );
      IntPtr imageCallbackData = IntPtr(1);

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying original image.
      Rectangle destRect1 = Rectangle(100,25,450,150);

      // Create coordinates of rectangle for source image.
      float x = 50.0F;
      float y = 50.0F;
      float width = 150.0F;
      float height = 150.0F;
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units );

      // Create rectangle for adjusted image.
      Rectangle destRect2 = Rectangle(100,175,450,150);

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );

      // Draw adjusted image to screen.
      try
      {
         // Draw adjusted image to screen.
         e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback, imageCallbackData );
      }
      catch ( Exception^ ex ) 
      {
         e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) );
      }
   }

// Define DrawImageAbort callback method.
private bool DrawImageCallback8(IntPtr callBackData)
{
             
    // Test for call that passes callBackData parameter.
    if(callBackData==IntPtr.Zero)
    {
             
        // If no callBackData passed, abort DrawImage method.
        return true;
    }
    else
    {
             
        // If callBackData passed, continue DrawImage method.
        return false;
    }
}
public void DrawImageRect4FloatAttribAbortData(PaintEventArgs e)
{
             
    // Create callback method.
    Graphics.DrawImageAbort imageCallback
        = new Graphics.DrawImageAbort(DrawImageCallback8);
    IntPtr imageCallbackData = new IntPtr(1);
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying original image.
    Rectangle destRect1 = new Rectangle(100, 25, 450, 150);
             
    // Create coordinates of rectangle for source image.
    float x = 50.0F;
    float y = 50.0F;
    float width = 150.0F;
    float height = 150.0F;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
             
    // Create rectangle for adjusted image.
    Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
             
    // Draw adjusted image to screen.
    try
    {
        checked
        {
             
            // Draw adjusted image to screen.
            e.Graphics.DrawImage(
                newImage,
                destRect2,
                x, y,
                width, height,
                units,
                imageAttr,
                imageCallback,
                imageCallbackData);
        }
    }
    catch (Exception ex)
    {
        e.Graphics.DrawString(
            ex.ToString(),
            new Font("Arial", 8),
            Brushes.Black,
            new PointF(0, 0));
    }
}
Private Function DrawImageCallback8(ByVal callBackData As IntPtr) As Boolean

    ' Test for call that passes callBackData parameter.
    If callBackData.Equals(IntPtr.Zero) Then

        ' If no callBackData passed, abort DrawImage method.
        Return True
    Else

        ' If callBackData passed, continue DrawImage method.
        Return False
    End If
End Function
Public Sub DrawImageRect4FloatAttribAbortData(ByVal e As PaintEventArgs)

    ' Create callback method.
    Dim imageCallback As New _
    Graphics.DrawImageAbort(AddressOf DrawImageCallback8)
    Dim imageCallbackData As New IntPtr(1)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying original image.
    Dim destRect1 As New Rectangle(100, 25, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Single = 50.0F
    Dim y As Single = 50.0F
    Dim width As Single = 150.0F
    Dim height As Single = 150.0F
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destRect1, x, y, width, _
    height, units)

    ' Create rectangle for adjusted image.
    Dim destRect2 As New Rectangle(100, 175, 450, 150)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)

    ' Draw adjusted image to screen.
    Try

        ' Draw adjusted image to screen.
        e.Graphics.DrawImage(newImage, destRect2, x, y, width, _
        height, units, imageAttr, imageCallback, imageCallbackData)
    Catch ex As Exception
        e.Graphics.DrawString(ex.ToString(), New Font("Arial", 8), _
        Brushes.Black, New PointF(0, 0))
    End Try
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

이 오버 로드 된 callbackcallbackData 매개 변수는 조건 및 애플리케이션에 의해 결정 되는 데이터에 따라 시작 되 면 이미지의 그리기를 중지 하는 방법을 제공 합니다. 예를 들어, 애플리케이션은 큰 이미지를 그리기 시작할 수 및 사용자 사례 애플리케이션 수 그리기를 중지 하는 화면 이미지를 스크롤할 수 있습니다.

추가 정보

적용 대상

DrawImage(Image, Rectangle, Single, Single, Single, Single, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * single * single * single * single * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcX As Single, srcY As Single, srcWidth As Single, srcHeight As Single, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcX
Single

그릴 원본 이미지 부분의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

srcY
Single

그릴 소스 이미지 부분의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcWidth
Single

그릴 소스 이미지의 부분에 대한 너비입니다.

srcHeight
Single

그릴 소스 이미지의 부분에 대한 높이입니다.

srcUnit
GraphicsUnit

소스 사각형을 결정하기 위해 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형의 좌표를 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

대상 사각형의 위치는 화면에서 이미지를 찾고, 원본 및 대상 사각형의 크기에 따라 그려진 이미지의 크기가 결정되며, 원본 사각형의 크기에 따라 원래 이미지가 화면에 그려지는 부분이 결정됩니다.

private:
   void DrawImageRect4Float( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying image.
      Rectangle destRect = Rectangle(100,100,450,150);

      // Create coordinates of rectangle for source image.
      float x = 50.0F;
      float y = 50.0F;
      float width = 150.0F;
      float height = 150.0F;
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destRect, x, y, width, height, units );
   }
private void DrawImageRect4Float(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying image.
    Rectangle destRect = new Rectangle(100, 100, 450, 150);
             
    // Create coordinates of rectangle for source image.
    float x = 50.0F;
    float y = 50.0F;
    float width = 150.0F;
    float height = 150.0F;
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, x, y, width, height, units);
}
Private Sub DrawImageRect4Float(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying image.
    Dim destRect As New Rectangle(100, 100, 450, 150)

    ' Create coordinates of rectangle for source image.
    Dim x As Single = 50.0F
    Dim y As Single = 50.0F
    Dim width As Single = 150.0F
    Dim height As Single = 150.0F
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, x, y, width, height, _
    units)
End Sub

설명

, , 및 매개 변수는 srcX그릴 개체의 image 사각형 부분을 지정합니다.srcHeightsrcWidthsrcY 사각형은 원본 이미지의 왼쪽 위 모서리를 기준으로 합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, Int32, Int32, Int32, Int32)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, int x, int y, int width, int height);
public void DrawImage (System.Drawing.Image image, int x, int y, int width, int height);
member this.DrawImage : System.Drawing.Image * int * int * int * int -> unit
Public Sub DrawImage (image As Image, x As Integer, y As Integer, width As Integer, height As Integer)

매개 변수

image
Image

그릴 Image입니다.

x
Int32

그려지는 이미지의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

y
Int32

그려지는 이미지의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

width
Int32

그려지는 이미지의 너비입니다.

height
Int32

그려지는 이미지의 높이입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 사각형의 위치와 크기를 만듭니다.

  • 이미지를 화면에 그립니다.

사각형의 위치는 화면에서 이미지를 찾고 원래 이미지의 크기와 사각형 크기에 따라 그려진 이미지의 크기가 결정됩니다.

public:
   void DrawImage4Int( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner.
      // of image and for size of image.
      int x = 100;
      int y = 100;
      int width = 450;
      int height = 150;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, x, y, width, height );
   }
public void DrawImage4Int(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create coordinates for upper-left corner.
             
    // of image and for size of image.
    int x = 100;
    int y = 100;
    int width = 450;
    int height = 150;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, width, height);
}
Public Sub DrawImage4Int(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create coordinates for upper-left corner

    ' of image and for size of image.
    Dim x As Integer = 100
    Dim y As Integer = 100
    Dim width As Integer = 450
    Dim height As Integer = 150

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, width, height)
End Sub

설명

, , ywidthheight 매개 변수로 x정의된 사각형은 그려진 이미지의 위치와 크기를 결정합니다.

추가 정보

적용 대상

DrawImage(Image, Single, Single, Single, Single)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, float x, float y, float width, float height);
public void DrawImage (System.Drawing.Image image, float x, float y, float width, float height);
member this.DrawImage : System.Drawing.Image * single * single * single * single -> unit
Public Sub DrawImage (image As Image, x As Single, y As Single, width As Single, height As Single)

매개 변수

image
Image

그릴 Image입니다.

x
Single

그려지는 이미지의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

y
Single

그려지는 이미지의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

width
Single

그려지는 이미지의 너비입니다.

height
Single

그려지는 이미지의 높이입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 사각형의 위치와 크기를 만듭니다.

  • 이미지를 화면에 그립니다.

사각형의 위치는 화면에서 이미지를 찾고 원래 이미지의 크기와 사각형 크기에 따라 그려진 이미지의 크기가 결정됩니다.

public:
   void DrawImage4Float( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner.
      // of image and for size of image.
      float x = 100.0F;
      float y = 100.0F;
      float width = 450.0F;
      float height = 150.0F;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, x, y, width, height );
   }
public void DrawImage4Float(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create coordinates for upper-left corner.
             
    // of image and for size of image.
    float x = 100.0F;
    float y = 100.0F;
    float width = 450.0F;
    float height = 150.0F;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, width, height);
}
Public Sub DrawImage4Float(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create coordinates for upper-left corner

    ' of image and for size of image.
    Dim x As Single = 100.0F
    Dim y As Single = 100.0F
    Dim width As Single = 450.0F
    Dim height As Single = 150.0F

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, width, height)
End Sub

설명

, , ywidthheight 매개 변수로 x정의된 사각형은 그려진 이미지의 위치와 크기를 결정합니다.

추가 정보

적용 대상

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr);
member this.DrawImage : System.Drawing.Image * System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes -> unit
Public Sub DrawImage (image As Image, destPoints As PointF(), srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttr As ImageAttributes)

매개 변수

image
Image

그릴 Image입니다.

destPoints
PointF[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

srcRect
RectangleF

그릴 image 개체의 부분을 지정하는 RectangleF 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 병렬 프로그래밍을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

조정되지 않은 원래 대상 병렬 프로그래밍의 경우 위치는 화면에서 이미지를 찾고, 원본 사각형의 크기 및 대상 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 및 전단이 결정되며, 사각형의 크기는 화면에 그려지는 원본 이미지의 부분을 결정합니다.

void DrawImageParaFRectFAttrib( PaintEventArgs^ e )
{
   // Create image.
   Image^ newImage = Image::FromFile( "SampImag.jpg" );

   // Create parallelogram for drawing original image.
   PointF ulCorner1 = PointF(100.0F,100.0F);
   PointF urCorner1 = PointF(325.0F,100.0F);
   PointF llCorner1 = PointF(150.0F,250.0F);
   array<PointF>^ destPara1 = {ulCorner1,urCorner1,llCorner1};

   // Create rectangle for source image.
   RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F);
   GraphicsUnit units = GraphicsUnit::Pixel;

   // Create parallelogram for drawing adjusted image.
   PointF ulCorner2 = PointF(325.0F,100.0F);
   PointF urCorner2 = PointF(550.0F,100.0F);
   PointF llCorner2 = PointF(375.0F,250.0F);
   array<PointF>^ destPara2 = {ulCorner2,urCorner2,llCorner2};

   // Draw original image to screen.
   e->Graphics->DrawImage( newImage, destPara1, srcRect, units );

   // Create image attributes and set large gamma.
   ImageAttributes^ imageAttr = gcnew ImageAttributes;
   imageAttr->SetGamma( 4.0F );

   // Draw adjusted image to screen.
   e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr );
}
private void DrawImageParaFRectFAttrib(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing original image.
    PointF ulCorner1 = new PointF(100.0F, 100.0F);
    PointF urCorner1 = new PointF(325.0F, 100.0F);
    PointF llCorner1 = new PointF(150.0F, 250.0F);
    PointF[] destPara1 = {ulCorner1, urCorner1, llCorner1};
             
    // Create rectangle for source image.
    RectangleF srcRect = new RectangleF(50.0F, 50.0F, 150.0F, 150.0F);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Create parallelogram for drawing adjusted image.
    PointF ulCorner2 = new PointF(325.0F, 100.0F);
    PointF urCorner2 = new PointF(550.0F, 100.0F);
    PointF llCorner2 = new PointF(375.0F, 250.0F);
    PointF[] destPara2 = {ulCorner2, urCorner2, llCorner2};
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units);
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
             
    // Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destPara2, srcRect, units, imageAttr);
}
Private Sub DrawImageParaFRectFAttrib(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing original image.
    Dim ulCorner1 As New PointF(100.0F, 100.0F)
    Dim urCorner1 As New PointF(325.0F, 100.0F)
    Dim llCorner1 As New PointF(150.0F, 250.0F)
    Dim destPara1 As PointF() = {ulCorner1, urCorner1, llCorner1}

    ' Create rectangle for source image.
    Dim srcRect As New RectangleF(50.0F, 50.0F, 150.0F, 150.0F)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Create parallelogram for drawing adjusted image.
    Dim ulCorner2 As New PointF(325.0F, 100.0F)
    Dim urCorner2 As New PointF(550.0F, 100.0F)
    Dim llCorner2 As New PointF(375.0F, 250.0F)
    Dim destPara2 As PointF() = {ulCorner2, urCorner2, llCorner2}

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units)

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)

    ' Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destPara2, srcRect, units, _
    imageAttr)
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 parallelogram 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

추가 정보

적용 대상

DrawImage(Image, Effect)

Source:
Graphics.cs
public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Imaging::Effects::Effect ^ effect);
public void DrawImage (System.Drawing.Image image, System.Drawing.Imaging.Effects.Effect effect);
member this.DrawImage : System.Drawing.Image * System.Drawing.Imaging.Effects.Effect -> unit
Public Sub DrawImage (image As Image, effect As Effect)

매개 변수

image
Image
effect
Effect

적용 대상

DrawImage(Image, Point)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 위치에 원래의 크기를 사용하여 특정 Image를 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Point point);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point point);
member this.DrawImage : System.Drawing.Image * System.Drawing.Point -> unit
Public Sub DrawImage (image As Image, point As Point)

매개 변수

image
Image

그릴 Image입니다.

point
Point

그려지는 이미지의 왼쪽 위 모퉁이의 위치를 나타내는 Point 구조체입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지의 왼쪽 위 모서리를 그릴 지점을 만듭니다.

  • 크기가 조정되지 않은 이미지를 화면에 그립니다.

private:
   void DrawImagePoint( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create Point for upper-left corner of image.
      Point ulCorner = Point(100,100);

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, ulCorner );
   }
private void DrawImagePoint(PaintEventArgs e)
{         
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create Point for upper-left corner of image.
    Point ulCorner = new Point(100, 100);
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner);
}
Private Sub DrawImagePoint(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create Point for upper-left corner of image.
    Dim ulCorner As New Point(100, 100)

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner)
End Sub

설명

Image 픽셀 너비의 값과 가로 해상도 값(인치당 점)을 저장합니다. 이미지의 실제 너비(인치 단위)는 픽셀 너비를 가로 해상도로 나눈 값입니다. 예를 들어 픽셀 너비가 216이고 가로 해상도가 인치당 72개인 이미지의 실제 너비는 3인치입니다. 픽셀 높이와 물리적 높이에 유사한 설명이 적용됩니다.

이 메서드는 이미지 인치 디스플레이 디바이스의 해상도 (인치당 도트 수)와 관계 없이 올바른 크기를 가집니다는 실제 크기를 사용 하 여 이미지를 그립니다. 예를 들어 이미지의 픽셀 너비가 216이고 가로 해상도가 인치당 72도트라고 가정합니다. 렌더링된 된 이미지의 픽셀 너비 (216/72) 수는 96dpi 해상도 포함 하는 디바이스에서 해당 이미지를 그릴이 메서드를 호출 하는 경우 * 96 = 288 개.

추가 정보

적용 대상

DrawImage(Image, Point[])

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image를 지정된 위치에 지정된 모양과 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::Point> ^ destPoints);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints);
member this.DrawImage : System.Drawing.Image * System.Drawing.Point[] -> unit
Public Sub DrawImage (image As Image, destPoints As Point())

매개 변수

image
Image

그릴 Image입니다.

destPoints
Point[]

평행 사변형을 정의하는 세 개의 Point 구조체 배열입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 이미지를 화면에 그립니다.

parallelogram의 위치는 화면에서 이미지를 찾고 원래 이미지의 크기와 병렬 프로그래밍의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

private:
   void DrawImagePara( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing image.
      Point ulCorner = Point(100,100);
      Point urCorner = Point(550,100);
      Point llCorner = Point(150,250);
      array<Point>^ destPara = {ulCorner,urCorner,llCorner};

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destPara );
   }
private void DrawImagePara(PaintEventArgs e)
{
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing image.
    Point ulCorner = new Point(100, 100);
    Point urCorner = new Point(550, 100);
    Point llCorner = new Point(150, 250);
    Point[] destPara = {ulCorner, urCorner, llCorner};
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara);
}
Private Sub DrawImagePara(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing image.
    Dim ulCorner As New Point(100, 100)
    Dim urCorner As New Point(550, 100)
    Dim llCorner As New Point(150, 250)
    Dim destPara As Point() = {ulCorner, urCorner, llCorner}

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara)
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 Point 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수로 image 표시되는 이미지는 매개 변수로 지정된 병렬 도형의 모양에 맞게 크기가 조정되고 전단됩니다 destPoints .

추가 정보

적용 대상

DrawImage(Image, PointF)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 위치에 원래의 크기를 사용하여 특정 Image를 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::PointF point);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF point);
member this.DrawImage : System.Drawing.Image * System.Drawing.PointF -> unit
Public Sub DrawImage (image As Image, point As PointF)

매개 변수

image
Image

그릴 Image입니다.

point
PointF

그려지는 이미지의 왼쪽 위 모퉁이를 나타내는 PointF 구조체입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지의 왼쪽 위 모서리를 그릴 지점을 만듭니다.

  • 크기가 조정되지 않은 이미지를 화면에 그립니다.

private:
   void DrawImagePointF( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create point for upper-left corner of image.
      PointF ulCorner = PointF(100.0F,100.0F);

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, ulCorner );
   }
private void DrawImagePointF(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create point for upper-left corner of image.
    PointF ulCorner = new PointF(100.0F, 100.0F);
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner);
}
Private Sub DrawImagePointF(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create point for upper-left corner of image.
    Dim ulCorner As New PointF(100.0F, 100.0F)

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner)
End Sub

설명

Image 픽셀 너비의 값과 가로 해상도 값(인치당 점)을 저장합니다. 이미지의 실제 너비(인치 단위)는 픽셀 너비를 가로 해상도로 나눈 값입니다. 예를 들어 픽셀 너비가 216이고 가로 해상도가 인치당 72개인 이미지의 실제 너비는 3인치입니다. 픽셀 높이와 물리적 높이에 유사한 설명이 적용됩니다.

이 메서드는 이미지 인치 디스플레이 디바이스의 해상도 (인치당 도트 수)와 관계 없이 올바른 크기를 가집니다는 실제 크기를 사용 하 여 이미지를 그립니다. 예를 들어 이미지의 픽셀 너비가 216이고 가로 해상도가 인치당 72도트라고 가정합니다. 렌더링된 된 이미지의 픽셀 너비 (216/72) 수는 96dpi 해상도 포함 하는 디바이스에서 해당 이미지를 그릴이 메서드를 호출 하는 경우 * 96 = 288 개.

추가 정보

적용 대상

DrawImage(Image, PointF[])

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image를 지정된 위치에 지정된 모양과 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::PointF> ^ destPoints);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints);
member this.DrawImage : System.Drawing.Image * System.Drawing.PointF[] -> unit
Public Sub DrawImage (image As Image, destPoints As PointF())

매개 변수

image
Image

그릴 Image입니다.

destPoints
PointF[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 이미지를 화면에 그립니다.

parallelogram의 위치는 화면에서 이미지를 찾고 원래 이미지의 크기와 병렬 프로그래밍의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

private:
   void DrawImageParaF( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing image.
      PointF ulCorner = PointF(100.0F,100.0F);
      PointF urCorner = PointF(550.0F,100.0F);
      PointF llCorner = PointF(150.0F,250.0F);
      array<PointF>^ destPara = {ulCorner,urCorner,llCorner};

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destPara );
   }
private void DrawImageParaF(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing image.
    PointF ulCorner = new PointF(100.0F, 100.0F);
    PointF urCorner = new PointF(550.0F, 100.0F);
    PointF llCorner = new PointF(150.0F, 250.0F);
    PointF[] destPara = {ulCorner, urCorner, llCorner};
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara);
}
Private Sub DrawImageParaF(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing image.
    Dim ulCorner As New PointF(100.0F, 100.0F)
    Dim urCorner As New PointF(550.0F, 100.0F)
    Dim llCorner As New PointF(150.0F, 250.0F)
    Dim destPara As PointF() = {ulCorner, urCorner, llCorner}

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara)
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

개체로 image 표현되는 이미지는 매개 변수로 지정된 parallelogram의 모양에 맞게 크기가 조정되고 전단됩니다 destPoints .

추가 정보

적용 대상

DrawImage(Image, Rectangle)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle rect);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle rect);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle -> unit
Public Sub DrawImage (image As Image, rect As Rectangle)

매개 변수

image
Image

그릴 Image입니다.

rect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 사각형을 만듭니다.

  • 이미지를 화면에 그립니다.

사각형의 위치는 화면에서 이미지를 찾고 원래 이미지의 크기와 사각형 크기에 따라 그려진 이미지의 크기가 결정됩니다.

private:
   void DrawImageRect( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying image.
      Rectangle destRect = Rectangle(100,100,450,150);

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destRect );
   }
private void DrawImageRect(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying image.
    Rectangle destRect = new Rectangle(100, 100, 450, 150);
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect);
}
Private Sub DrawImageRect(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying image.
    Dim destRect As New Rectangle(100, 100, 450, 150)

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect)
End Sub

설명

개체가 image 나타내는 이미지는 사각형의 rect 크기로 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, RectangleF)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image를 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::RectangleF rect);
public void DrawImage (System.Drawing.Image image, System.Drawing.RectangleF rect);
member this.DrawImage : System.Drawing.Image * System.Drawing.RectangleF -> unit
Public Sub DrawImage (image As Image, rect As RectangleF)

매개 변수

image
Image

그릴 Image입니다.

rect
RectangleF

그려지는 이미지의 위치와 크기를 지정하는 RectangleF 구조체입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 사각형을 만듭니다.

  • 이미지를 화면에 그립니다.

사각형의 위치는 화면에서 이미지를 찾고 이미지의 원래 크기와 사각형 크기에 따라 그려진 이미지의 크기가 결정됩니다.

public:
   void DrawImageRectF( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying image.
      RectangleF rect = RectangleF(100.0F,100.0F,450.0F,150.0F);

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, rect );
   }
public void DrawImageRectF(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying image.
    RectangleF rect = new RectangleF(100.0F, 100.0F, 450.0F, 150.0F);
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, rect);
}
Public Sub DrawImageRectF(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying image.
    Dim rect As New RectangleF(100.0F, 100.0F, 450.0F, 150.0F)

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, rect)
End Sub

설명

개체가 image 나타내는 이미지는 사각형의 rect 크기로 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, Int32, Int32, Rectangle, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

이미지의 부분을 지정된 위치에 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, int x, int y, System::Drawing::Rectangle srcRect, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, int x, int y, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * int * int * System.Drawing.Rectangle * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, x As Integer, y As Integer, srcRect As Rectangle, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

x
Int32

그려지는 이미지의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

y
Int32

그려지는 이미지의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

srcRect
Rectangle

그릴 image 개체의 부분을 지정하는 Rectangle 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지의 왼쪽 위 모서리를 그릴 좌표를 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

원본 사각형의 크기에 따라 크기가 조정되지 않은 원본 이미지가 화면에 그려지는 부분이 결정됩니다.

public:
   void DrawImage2IntRect( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner of image.
      int x = 100;
      int y = 100;

      // Create rectangle for source image.
      Rectangle srcRect = Rectangle(50,50,150,150);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, x, y, srcRect, units );
   }
public void DrawImage2IntRect(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create coordinates for upper-left corner of image.
    int x = 100;
    int y = 100;
             
    // Create rectangle for source image.
    Rectangle srcRect = new Rectangle(50, 50, 150, 150);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, srcRect, units);
}
Public Sub DrawImage2IntRect(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create coordinates for upper-left corner of image.
    Dim x As Integer = 100
    Dim y As Integer = 100

    ' Create rectangle for source image.
    Dim srcRect As New Rectangle(50, 50, 150, 150)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y, srcRect, units)
End Sub

설명

Image 픽셀 너비의 값과 가로 해상도 값(인치당 점)을 저장합니다. 이미지의 실제 너비(인치 단위)는 픽셀 너비를 가로 해상도로 나눈 값입니다. 예를 들어 픽셀 너비가 360이고 가로 해상도가 인치당 72개인 이미지는 실제 너비가 5인치입니다. 픽셀 높이와 물리적 높이에 유사한 설명이 적용됩니다.

이 메서드는 실제 크기를 사용 하 여 이미지 부분을 인치 디스플레이 디바이스의 해상도 (인치당 도트 수)와 관계 없이 올바른 크기를 가집니다 이미지의 일부를 그립니다. 예를 들어 이미지 부분에 픽셀 너비가 216이고 가로 해상도가 인치당 72도트라고 가정합니다. 부분 렌더링된 이미지의 픽셀 너비 (216/72) 부분을 그릴 이미지 96dpi 해상도 포함 하는 디바이스에서이 메서드를 호출 하면 수 * 96 = 288 개.

추가 정보

적용 대상

DrawImage(Image, Single, Single)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 위치에 원래의 크기를 사용하여 특정 Image를 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, float x, float y);
public void DrawImage (System.Drawing.Image image, float x, float y);
member this.DrawImage : System.Drawing.Image * single * single -> unit
Public Sub DrawImage (image As Image, x As Single, y As Single)

매개 변수

image
Image

그릴 Image입니다.

x
Single

그려지는 이미지의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

y
Single

그려지는 이미지의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지의 왼쪽 위 모서리를 그릴 지점의 좌표를 만듭니다.

  • 크기가 조정되지 않은 이미지를 화면에 그립니다.

public:
   void DrawImage2Float( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner of image.
      float x = 100.0F;
      float y = 100.0F;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, x, y );
   }
public void DrawImage2Float(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create coordinates for upper-left corner of image.
    float x = 100.0F;
    float y = 100.0F;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y);
}
Public Sub DrawImage2Float(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create coordinates for upper-left corner of image.
    Dim x As Single = 100.0F
    Dim y As Single = 100.0F

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y)
End Sub

설명

Image 픽셀 너비의 값과 가로 해상도 값(인치당 점)을 저장합니다. 이미지의 실제 너비(인치 단위)는 픽셀 너비를 가로 해상도로 나눈 값입니다. 예를 들어 픽셀 너비가 216이고 가로 해상도가 인치당 72개인 이미지의 실제 너비는 3인치입니다. 픽셀 높이와 물리적 높이에 유사한 설명이 적용됩니다.

이 메서드는 이미지 인치 디스플레이 디바이스의 해상도 (인치당 도트 수)와 관계 없이 올바른 크기를 가집니다는 실제 크기를 사용 하 여 이미지를 그립니다. 예를 들어 이미지의 픽셀 너비가 216이고 가로 해상도가 인치당 72도트라고 가정합니다. 렌더링된 된 이미지의 픽셀 너비 (216/72) 수는 96dpi 해상도 포함 하는 디바이스에서 해당 이미지를 그릴이 메서드를 호출 하는 경우 * 96 = 288 개.

추가 정보

적용 대상

DrawImage(Image, Point[], Rectangle, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::Point> ^ destPoints, System::Drawing::Rectangle srcRect, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * System.Drawing.Point[] * System.Drawing.Rectangle * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, destPoints As Point(), srcRect As Rectangle, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

destPoints
Point[]

평행 사변형을 정의하는 세 개의 Point 구조체 배열입니다.

srcRect
Rectangle

그릴 image 개체의 부분을 지정하는 Rectangle 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 그릴 이미지의 부분을 선택하는 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

parallelogram의 위치는 화면에서 이미지를 찾고 사각형의 크기와 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

private:
   void DrawImageParaRect( PaintEventArgs^ e )
   {

      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing image.
      Point ulCorner = Point(100,100);
      Point urCorner = Point(325,100);
      Point llCorner = Point(150,250);
      array<Point>^ destPara = {ulCorner,urCorner,llCorner};

      // Create rectangle for source image.
      Rectangle srcRect = Rectangle(50,50,150,150);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destPara, srcRect, units );
   }
private void DrawImageParaRect(PaintEventArgs e)
{
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing image.
    Point ulCorner = new Point(100, 100);
    Point urCorner = new Point(325, 100);
    Point llCorner = new Point(150, 250);
    Point[] destPara = {ulCorner, urCorner, llCorner};
             
    // Create rectangle for source image.
    Rectangle srcRect = new Rectangle(50, 50, 150, 150);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara, srcRect, units);
}
Private Sub DrawImageParaRect(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing image.
    Dim ulCorner As New Point(100, 100)
    Dim urCorner As New Point(325, 100)
    Dim llCorner As New Point(150, 250)
    Dim destPara As Point() = {ulCorner, urCorner, llCorner}

    ' Create rectangle for source image.
    Dim srcRect As New Rectangle(50, 50, 150, 150)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara, srcRect, units)
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 Point 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 parallelogram 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

추가 정보

적용 대상

DrawImage(Image, PointF[], RectangleF, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, destPoints As PointF(), srcRect As RectangleF, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

destPoints
PointF[]

평행 사변형을 정의하는 세 개의 PointF 구조체 배열입니다.

srcRect
RectangleF

그릴 image 개체의 부분을 지정하는 RectangleF 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

대상 parallelogram의 위치는 화면에서 이미지를 찾습니다. 원본 사각형의 크기 및 대상 병렬 프로그래밍의 크기와 모양은 그린 이미지의 크기 조정 및 전단을 결정하며 사각형의 크기는 화면에 그려지는 원본 이미지의 부분을 결정합니다.

private:
   void DrawImageParaFRectF( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing image.
      PointF ulCorner = PointF(100.0F,100.0F);
      PointF urCorner = PointF(550.0F,100.0F);
      PointF llCorner = PointF(150.0F,250.0F);
      array<PointF>^ destPara = {ulCorner,urCorner,llCorner};

      // Create rectangle for source image.
      RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destPara, srcRect, units );
   }
private void DrawImageParaFRectF(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing image.
    PointF ulCorner = new PointF(100.0F, 100.0F);
    PointF urCorner = new PointF(550.0F, 100.0F);
    PointF llCorner = new PointF(150.0F, 250.0F);
    PointF[] destPara = {ulCorner, urCorner, llCorner};
             
    // Create rectangle for source image.
    RectangleF srcRect = new RectangleF(50.0F, 50.0F, 150.0F, 150.0F);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara, srcRect, units);
}
Private Sub DrawImageParaFRectF(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing image.
    Dim ulCorner As New PointF(100.0F, 100.0F)
    Dim urCorner As New PointF(550.0F, 100.0F)
    Dim llCorner As New PointF(150.0F, 250.0F)
    Dim destPara As PointF() = {ulCorner, urCorner, llCorner}

    ' Create rectangle for source image.
    Dim srcRect As New RectangleF(50.0F, 50.0F, 150.0F, 150.0F)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destPara, srcRect, units)
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 PointF 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 parallelogram 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

추가 정보

적용 대상

DrawImage(Image, Rectangle, Rectangle, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::Rectangle destRect, System::Drawing::Rectangle srcRect, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, System.Drawing.Rectangle destRect, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * System.Drawing.Rectangle * System.Drawing.Rectangle * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, destRect As Rectangle, srcRect As Rectangle, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

destRect
Rectangle

그려지는 이미지의 위치와 크기를 지정하는 Rectangle 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcRect
Rectangle

그릴 image 개체의 부분을 지정하는 Rectangle 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

대상 사각형의 위치는 화면에서 이미지를 찾고, 원본 및 대상 사각형의 크기에 따라 그려진 이미지의 크기가 결정되며, 원본 사각형의 크기에 따라 원래 이미지가 화면에 그려지는 부분이 결정됩니다.

private:
   void DrawImageRectRect( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying image.
      Rectangle destRect = Rectangle(100,100,450,150);

      // Create rectangle for source image.
      Rectangle srcRect = Rectangle(50,50,150,150);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destRect, srcRect, units );
   }
private void DrawImageRectRect(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying image.
    Rectangle destRect = new Rectangle(100, 100, 450, 150);
             
    // Create rectangle for source image.
    Rectangle srcRect = new Rectangle(50, 50, 150, 150);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, srcRect, units);
}
Private Sub DrawImageRectRect(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying image.
    Dim destRect As New Rectangle(100, 100, 450, 150)

    ' Create rectangle for source image.
    Dim srcRect As New Rectangle(50, 50, 150, 150)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, srcRect, units)
End Sub

설명

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, RectangleF, RectangleF, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 지정된 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, System::Drawing::RectangleF destRect, System::Drawing::RectangleF srcRect, System::Drawing::GraphicsUnit srcUnit);
public void DrawImage (System.Drawing.Image image, System.Drawing.RectangleF destRect, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit);
member this.DrawImage : System.Drawing.Image * System.Drawing.RectangleF * System.Drawing.RectangleF * System.Drawing.GraphicsUnit -> unit
Public Sub DrawImage (image As Image, destRect As RectangleF, srcRect As RectangleF, srcUnit As GraphicsUnit)

매개 변수

image
Image

그릴 Image입니다.

destRect
RectangleF

그려지는 이미지의 위치와 크기를 지정하는 RectangleF 구조체입니다. 이미지는 사각형에 맞게 크기가 조정됩니다.

srcRect
RectangleF

그릴 image 개체의 부분을 지정하는 RectangleF 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 대상 사각형을 만듭니다.

  • 이미지의 일부를 추출할 원본 사각형을 만듭니다.

  • 원본 사각형의 측정 단위를 픽셀로 설정합니다.

  • 이미지를 화면에 그립니다.

대상 사각형의 위치는 화면에서 이미지를 찾고, 원본 및 대상 사각형의 크기에 따라 그려진 이미지의 크기가 결정되며, 원본 사각형의 크기에 따라 원래 이미지가 화면에 그려지는 부분이 결정됩니다.

public:
   void DrawImageRectFRectF( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create rectangle for displaying image.
      RectangleF destRect = RectangleF(100.0F,100.0F,450.0F,150.0F);

      // Create rectangle for source image.
      RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, destRect, srcRect, units );
   }
public void DrawImageRectFRectF(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create rectangle for displaying image.
    RectangleF destRect = new RectangleF(100.0F, 100.0F, 450.0F, 150.0F);
             
    // Create rectangle for source image.
    RectangleF srcRect = new RectangleF(50.0F, 50.0F, 150.0F, 150.0F);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, srcRect, units);
}
Public Sub DrawImageRectFRectF(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create rectangle for displaying image.
    Dim destRect As New RectangleF(100.0F, 100.0F, 450.0F, 150.0F)

    ' Create rectangle for source image.
    Dim srcRect As New RectangleF(50.0F, 50.0F, 150.0F, 150.0F)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, destRect, srcRect, units)
End Sub

설명

매개 변수는 srcRect 그릴 개체의 image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 사각형 내부에 맞게 크기가 destRect 조정됩니다.

추가 정보

적용 대상

DrawImage(Image, Int32, Int32)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 이미지를 좌표 쌍으로 지정된 위치에 원래 실제 크기로 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, int x, int y);
public void DrawImage (System.Drawing.Image image, int x, int y);
member this.DrawImage : System.Drawing.Image * int * int -> unit
Public Sub DrawImage (image As Image, x As Integer, y As Integer)

매개 변수

image
Image

그릴 Image입니다.

x
Int32

그려지는 이미지의 왼쪽 위 모퉁이에 대한 X 좌표입니다.

y
Int32

그려지는 이미지의 왼쪽 위 모퉁이에 대한 Y 좌표입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 있는 예제 SampImag.jpg 폴더에 있는 JPEG 파일 SampImag.jpg 이미지를 만듭니다.

  • 이미지의 왼쪽 위 모서리를 그릴 지점의 좌표를 만듭니다.

  • 크기가 조정되지 않은 이미지를 그립니다.

public:
   void DrawImage2Int( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner of image.
      int x = 100;
      int y = 100;

      // Draw image to screen.
      e->Graphics->DrawImage( newImage, x, y );
   }
public void DrawImage2Int(PaintEventArgs e)
{
                
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
                
    // Create coordinates for upper-left corner of image.
    int x = 100;
    int y = 100;
                
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y);
}
Public Sub DrawImage2Int(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create coordinates for upper-left corner of image.
    Dim x As Integer = 100
    Dim y As Integer = 100

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, x, y)
End Sub

설명

Image 픽셀 너비의 값과 가로 해상도(인치당 점)의 값을 저장합니다. 이미지의 실제 너비(인치 단위)는 픽셀 너비를 가로 해상도로 나눈 값입니다. 예를 들어 픽셀 너비가 216이고 가로 해상도가 인치당 72개인 이미지는 실제 너비가 3인치입니다. 픽셀 높이와 물리적 높이에 유사한 설명이 적용됩니다.

DrawImage 메서드 인치 디스플레이 디바이스의 해상도 (인치당 도트 수)와 관계 없이 올바른 크기를 가집니다 이미지는 실제 크기를 사용 하 여 이미지를 그립니다. 예를 들어 이미지의 픽셀 너비가 216이고 가로 해상도가 인치당 72도트라고 가정합니다. 호출 하는 경우 DrawImage 96dpi 해상도 포함 하는 디바이스에서 해당 이미지를 그릴 렌더링 되는 이미지의 픽셀 너비 됩니다 (216/72) * 96 = 288 개.

추가 정보

적용 대상

DrawImage(Image, Point[], Rectangle, GraphicsUnit, ImageAttributes)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

지정된 Image의 지정된 부분을 지정된 위치에 그립니다.

public:
 void DrawImage(System::Drawing::Image ^ image, cli::array <System::Drawing::Point> ^ destPoints, System::Drawing::Rectangle srcRect, System::Drawing::GraphicsUnit srcUnit, System::Drawing::Imaging::ImageAttributes ^ imageAttr);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr);
public void DrawImage (System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes? imageAttr);
member this.DrawImage : System.Drawing.Image * System.Drawing.Point[] * System.Drawing.Rectangle * System.Drawing.GraphicsUnit * System.Drawing.Imaging.ImageAttributes -> unit
Public Sub DrawImage (image As Image, destPoints As Point(), srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttr As ImageAttributes)

매개 변수

image
Image

그릴 Image입니다.

destPoints
Point[]

평행 사변형을 정의하는 세 개의 Point 구조체 배열입니다.

srcRect
Rectangle

그릴 image 개체의 부분을 지정하는 Rectangle 구조체입니다.

srcUnit
GraphicsUnit

srcRect 매개 변수가 사용하는 측정 단위를 지정하는 GraphicsUnit 열거형의 멤버입니다.

imageAttr
ImageAttributes

image 개체에 대한 다시 칠하기와 감마 정보를 지정하는 ImageAttributes입니다.

예외

image이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 예제의 폴더에 SampImag.jpg JPEG 파일에서 이미지를 만듭니다.

  • 이미지를 그릴 병렬 프로그래밍을 정의하는 점을 만듭니다.

  • 그릴 이미지 부분을 선택하는 사각형을 만듭니다.

  • 그래픽 그리기 단위를 픽셀로 설정합니다.

  • 원래 이미지를 화면에 그립니다.

  • 조정된 이미지를 그릴 추가 병렬 프로그래밍을 만듭니다.

  • 조정된 이미지의 특성을 만들고 설정하여 평소보다 큰 감마 값을 갖습니다.

  • 조정된 이미지를 화면에 그립니다.

원래의 조정되지 않은 병렬 도형의 경우 위치는 화면에서 이미지를 찾고 사각형의 크기와 병렬 도형의 크기와 모양에 따라 그려진 이미지의 크기 조정 및 전단이 결정됩니다.

private:
   void DrawImageParaRectAttrib( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create parallelogram for drawing image.
      Point ulCorner1 = Point(100,100);
      Point urCorner1 = Point(325,100);
      Point llCorner1 = Point(150,250);
      array<Point>^ destPara1 = {ulCorner1,urCorner1,llCorner1};

      // Create rectangle for source image.
      Rectangle srcRect = Rectangle(50,50,150,150);
      GraphicsUnit units = GraphicsUnit::Pixel;

      // Draw original image to screen.
      e->Graphics->DrawImage( newImage, destPara1, srcRect, units );

      // Create parallelogram for drawing adjusted image.
      Point ulCorner2 = Point(325,100);
      Point urCorner2 = Point(550,100);
      Point llCorner2 = Point(375,250);
      array<Point>^ destPara2 = {ulCorner2,urCorner2,llCorner2};

      // Create image attributes and set large gamma.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 4.0F );

      // Draw adjusted image to screen.
      e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr );
   }
private void DrawImageParaRectAttrib(PaintEventArgs e)
{
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create parallelogram for drawing image.
    Point ulCorner1 = new Point(100, 100);
    Point urCorner1 = new Point(325, 100);
    Point llCorner1 = new Point(150, 250);
    Point[] destPara1 = {ulCorner1, urCorner1, llCorner1};
             
    // Create rectangle for source image.
    Rectangle srcRect = new Rectangle(50, 50, 150, 150);
    GraphicsUnit units = GraphicsUnit.Pixel;
             
    // Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units);
             
    // Create parallelogram for drawing adjusted image.
    Point ulCorner2 = new Point(325, 100);
    Point urCorner2 = new Point(550, 100);
    Point llCorner2 = new Point(375, 250);
    Point[] destPara2 = {ulCorner2, urCorner2, llCorner2};
             
    // Create image attributes and set large gamma.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(4.0F);
             
    // Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destPara2, srcRect, units, imageAttr);
}
Private Sub DrawImageParaRectAttrib(ByVal e As PaintEventArgs)

    ' Create image.
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create parallelogram for drawing image.
    Dim ulCorner1 As New Point(100, 100)
    Dim urCorner1 As New Point(325, 100)
    Dim llCorner1 As New Point(150, 250)
    Dim destPara1 As Point() = {ulCorner1, urCorner1, llCorner1}

    ' Create rectangle for source image.
    Dim srcRect As New Rectangle(50, 50, 150, 150)
    Dim units As GraphicsUnit = GraphicsUnit.Pixel

    ' Draw original image to screen.
    e.Graphics.DrawImage(newImage, destPara1, srcRect, units)

    ' Create parallelogram for drawing adjusted image.
    Dim ulCorner2 As New Point(325, 100)
    Dim urCorner2 As New Point(550, 100)
    Dim llCorner2 As New Point(375, 250)
    Dim destPara2 As Point() = {ulCorner2, urCorner2, llCorner2}

    ' Create image attributes and set large gamma.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetGamma(4.0F)

    ' Draw adjusted image to screen.
    e.Graphics.DrawImage(newImage, destPara2, srcRect, units, _
    imageAttr)
End Sub

설명

매개 변수는 destPoints 병렬 프로그래밍의 세 점을 지정합니다. 세 Point 구조체는 병렬 프로그래밍의 왼쪽 위, 오른쪽 위 및 왼쪽 아래 모서리를 나타냅니다. 네 번째 점은 처음 세 개에서 추정되어 병렬 프로그래밍을 형성합니다.

매개 변수는 srcRect 그릴 개체의image 사각형 부분을 지정합니다. 이 부분은 매개 변수로 지정된 병렬 프로그래밍 내에 맞게 크기가 조정되고 전단됩니다 destPoints .

추가 정보

적용 대상