Description
The Rect
property of the Bitmap
class represents the rectangular area that defines the boundaries of the bitmap. This property is of type Sandbox.Rect
, which typically includes properties such as X
, Y
, Width
, and Height
to describe the position and size of the rectangle.
Usage
Use the Rect
property to retrieve or set the dimensions and position of the bitmap within its coordinate space. This can be useful for operations that require knowledge of the bitmap's size or for manipulating the bitmap's layout in a graphical interface.
Example
// Example of accessing the Rect property of a Bitmap
Bitmap bitmap = new Bitmap();
Rect bitmapRect = bitmap.Rect;
// Output the dimensions of the bitmap
int width = bitmapRect.Width;
int height = bitmapRect.Height;
// Set a new Rect for the bitmap
bitmap.Rect = new Rect(0, 0, 100, 100);