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
[C#]
public BitmapData LockBits(
 Rectangle rect,
 ImageLockMode flags,
 PixelFormat format
);
[C++]
public: BitmapData* LockBits(
 Rectangle rect,
 ImageLockMode flags,
 PixelFormat format
);
[JScript]
public function LockBits(
   rect : Rectangle,
 flags : ImageLockMode,
 format : PixelFormat
) : BitmapData;

Parameters

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

Return Value

A BitmapData object containing information about this lock operation.

Remarks

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).

Requirements

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

Show: