Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Bitmap.LockBits Method (Rectangle, ImageLockMode, PixelFormat, BitmapData)

Locks a Bitmap into system memory

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)
public BitmapData LockBits(
	Rectangle rect,
	ImageLockMode flags,
	PixelFormat format,
	BitmapData bitmapData
)

Parameters

rect
Type: System.Drawing.Rectangle

A rectangle structure specifying the portion of the Bitmap to lock.

flags
Type: System.Drawing.Imaging.ImageLockMode

One of the ImageLockMode values specifying the access level (read/write) for the Bitmap.

format
Type: System.Drawing.Imaging.PixelFormat

One of the PixelFormat values indicating the data format of the Bitmap.

bitmapData
Type: System.Drawing.Imaging.BitmapData

A BitmapData containing information about the lock operation.

Return Value

Type: System.Drawing.Imaging.BitmapData
A BitmapData containing information about the lock operation.
ExceptionCondition
ArgumentException

PixelFormat value is not a specific bits-per-pixel value.

-or-

The incorrect PixelFormat is passed in for a bitmap.

Exception

The operation failed.

This version of the LockBits method is intended to be used with a flags value of ImageLockMode.UserInputBuffer.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.