This documentation is for the old version. Go to the latest Graphics Mill docs

Bitmap.LockBits Method

Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).

Overload List

Name Description
Public method LockBits()

Locks a entire bitmap and returns BitmapData object which provides direct access to pixels (without copying).

Public method LockBits(Rectangle)

Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).

Public method LockBits(RectangleF)

Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).

Public method LockBits(Int32, Int32, Int32, Int32)

Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).

Public method LockBits(Single, Single, Single, Single)

Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).

Remarks

Each call of this method should be followed with subsequent UnlockBits(BitmapData) method call. You cannot lock bits one more time until you unlock them with UnlockBits(BitmapData). You can check if bits are locked with BitsLocked property.

Note

If the specified rectangular area excides the Bitmap dimensions you will get the BitmapData object with the same dimensions as an initial Bitmap. Therefore, to avoid further errors, you should use the Width and Height properties of this BitmapData object instead of the specified rectangle dimensions.

See Also

Reference