Bitmap.Clone

Clone(Rectangle, PixelFormat)

Creates a copy of the section of this Bitmap defined by Rectangle structure and with a specified PixelFormat enumeration.

public Bitmap Clone(Rectangle rect, PixelFormat format)
ParameterTypeDescription
rectRectangleDefines the portion of this Bitmap to copy. Coordinates are relative to this Bitmap.
formatPixelFormatSpecifies the PixelFormat enumeration for the destination Bitmap.

Return Value

The new Bitmap that this method creates.

See Also


Clone(RectangleF, PixelFormat)

Creates a copy of the section of this Bitmap defined with a specified PixelFormat enumeration.

public Bitmap Clone(RectangleF rect, PixelFormat format)
ParameterTypeDescription
rectRectangleFDefines the portion of this Bitmap to copy.
formatPixelFormatSpecifies the PixelFormat enumeration for the destination Bitmap.

Return Value

The Bitmap that this method creates.

Exceptions

exceptioncondition
OutOfMemoryExceptionrect is outside of the source bitmap bounds.
ArgumentExceptionThe height or width of rect is 0.

See Also