This documentation is archived and is not being maintained.

Bitmap.LockBits Method

Locks a Bitmap object into system memory.

[Visual Basic]
Public Function LockBits( _
   ByVal rect As Rectangle, _
   ByVal flags As ImageLockMode, _
   ByVal format As PixelFormat _
) As BitmapData
public BitmapData LockBits(
 Rectangle rect,
 ImageLockMode flags,
 PixelFormat format
public: BitmapData* LockBits(
 Rectangle rect,
 ImageLockMode flags,
 PixelFormat format
public function LockBits(
   rect : Rectangle,
 flags : ImageLockMode,
 format : PixelFormat
) : BitmapData;


A Rectangle structure specifying the portion of the Bitmap to lock.
An ImageLockMode enumeration specifying access level (read and write) for the Bitmap object.
A PixelFormat enumeration specifying the data format of this Bitmap object.

Return Value

A BitmapData object containing information about this lock operation.


The BitmapData object specifies the attributes of the Bitmap object, such as size, pixel format, the starting address of the pixel data in memory and length of each scan line (stride).


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Bitmap Class | Bitmap Members | System.Drawing Namespace