Bitmap.LockBits

Bitmap.LockBits method

Locks a Bitmap into system memory.

public BitmapData LockBits(RectangleF rect, ImageLockMode flags, PixelFormat format)
ParameterTypeDescription
rectRectangleFA Rectangle structure specifying the portion of the Bitmap to lock.
flagsImageLockModeAn ImageLockMode enumeration specifying the access level (read/write) for the Bitmap.
formatPixelFormatA PixelFormat enumeration specifying the data format of this Bitmap.

Return Value

A BitmapData containing information about this lock operation.

Exceptions

exceptioncondition
ArgumentExceptionThe PixelFormat is not a specific bits-per-pixel value.-or-The incorrect PixelFormat is passed in for a bitmap.
ExceptionThe operation failed.

See Also