System.Drawing.Graphics.DrawImage Method

Draws the specified portion of the specified System.Drawing.Image at the specified location and with the specified size.

Syntax

public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr)

Parameters

image
System.Drawing.Image to draw.
destRect
System.Drawing.Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
srcX
The x-coordinate of the upper-left corner of the portion of the source image to draw.
srcY
The y-coordinate of the upper-left corner of the portion of the source image to draw.
srcWidth
Width of the portion of the source image to draw.
srcHeight
Height of the portion of the source image to draw.
srcUnit
Member of the System.Drawing.GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.
imageAttr
System.Drawing.Imaging.ImageAttributes that specifies recoloring and gamma information for the image object.

Remarks

The srcX, srcY, srcWidth, and srcHeight parameters specify a rectangular portion, of the image object to draw. The rectangle is relative to the upper-left corner of the source image. This portion is scaled to fit inside the rectangle specified by the destRect parameter.

Requirements

Namespace: System.Drawing
Assembly: System.Drawing (in System.Drawing.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0