void DrawRect( Rect rect )
void DrawRect( float x, float y, float width, float height )

book_4_sparkGenerated
code_blocksInput

Description

The DrawRect method is used to draw a rectangle on the bitmap. This method takes a Sandbox.Rect parameter that defines the position and size of the rectangle to be drawn.

Usage

To use the DrawRect method, you need to have an instance of the Bitmap class. You can then call this method with a Rect object that specifies the dimensions and position of the rectangle you want to draw.

Example

// Create a new Bitmap instance
Bitmap bitmap = new Bitmap();

// Define a rectangle with position (10, 10) and size (100, 50)
Rect rect = new Rect(10, 10, 100, 50);

// Draw the rectangle on the bitmap
bitmap.DrawRect(rect);