IGxGraphics.FillColorRectangleF

Syntax

FillColorRectangleF(Color: IGxColor; Rect: IGxRectF);

Parameters

Color. Color that is used to fill a rectangle.

Rect. Real rectangle.

Description

The FillColorRectangleF method fills the real rectangle with the color passed by the Color parameter.

Fore Example

Executing the example requires a form with the button named Button1 and the ImageBox component named ImageBox1. Add links to the Drawing, Forms system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

BMP: IGxBitmap;

Graph: IGxGraphics;

GraphClass: GxGraphicsClass;

Color: IGxColor;

RectF: IGxRectF;

x, y, i, j: Double;

Begin

BMP := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Unknown);

Color := GxColor.FromValue(Math.RandBetweenI(0, 65536));

x := Math.RandBetween(0, ImageBox1.ClientWidth / 2);

y := Math.RandBetween(0, ImageBox1.ClientHeight / 2);

i := Math.RandBetween(ImageBox1.ClientWidth / 2, ImageBox1.ClientWidth);

j := Math.RandBetween(ImageBox1.ClientHeight / 2, ImageBox1.ClientHeight);

RectF := New GxRectF.Create(x, y, i, j);

GraphClass := New GxGraphics.Create;

Graph := GraphClass.FromImage(BMP);

Graph.FillColorRectangleF(Color, RectF);

ImageBox1.Image := BMP;

End Sub Button1OnClick;

After executing the example clicking the button in the ImageBox component displays a new bitmap with the rectangle of random size and color.

See also:

IGxGraphics