---
title: "Bitmap..::.LockBits Method (RectangleF)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_LockBits_1_a73b99d3.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 (RectangleF)
 
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 ( _rectangle As RectangleF _
) As BitmapData
```
 
```csharp
public BitmapData LockBits(RectangleF rectangle
)
```
 
### Parameters
 
 - rectangle
     - Type: [System.Drawing.RectangleF](http://msdn2.microsoft.com/en-us/kwafa1d7)
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)
