---
title: "Bitmap..::.LockBits Method (Single, Single, Single, Single)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_LockBits_4_37f6c741.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# Bitmap.LockBits Method (Single, Single, Single, Single)
 
Locks a rectangular area of the bitmap and returns [BitmapData](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_BitmapData.htm.md) object which provides direct access to pixels (without copying).
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Function LockBits ( _left As Single, _top As Single, _width As Single, _height As Single _
) As BitmapData
```
 
```csharp
public BitmapData LockBits(float left,float top,float width,float height
)
```
 
### Parameters
 
 - left
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
X-coordinate of the top left corner of the rectangular area to lock.

 - top
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
Y-coordinate of the top left corner of the rectangular area to lock.

 - width
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
Width of the rectangular area to lock.

 - height
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
Height of the rectangular area to lock.
 
### Return Value
 [BitmapData](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_BitmapData.htm.md) object which provides direct access to pixels.
 
## Remarks
  
Each call of this method should be followed with subsequent [UnlockBits(BitmapData)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_UnlockBits_1_ed2555df.htm.md) method call. You cannot lock bits one more time until you unlock them with [UnlockBits(BitmapData)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_UnlockBits_1_ed2555df.htm.md). You can check if bits are locked with [BitsLocked](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_BitsLocked.htm.md) property.
 
Rectangle parameters are measured in units specified with [Unit](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_UnitConverterObject_Unit.htm.md) property of the source bitmap.
 
If you want to load all pixels of the bitmap, you can use [overloaded version without arguments](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_LockBits.htm.md).
   
## See Also

### Reference

- [Bitmap Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
- [LockBits Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Bitmap_LockBits.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
