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.

Example

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Img: IGxBitmap;
    ImgColor: IGxColor;
    RectF: IGxRectF;
    Graph: IGxGraphics;
    l, t, r, b: Double;
Begin
    Img:= GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Format32bppArgb);
    ImgColor := GxColor.FromValue(Math.RandBetweenI(
0, Integer.MaxValue));
    l := Math.RandBetween(
0, ImageBox1.ClientWidth / 2);
    t := Math.RandBetween(
0, ImageBox1.ClientHeight / 2);
    r := Math.RandBetween(ImageBox1.ClientWidth / 
2, ImageBox1.ClientWidth);
    b := Math.RandBetween(ImageBox1.ClientHeight / 
2, ImageBox1.ClientHeight);
    RectF := 
New GxRectF.Create(l, t, r, b);
    Graph := GxGraphicsClass.FromImage(Img);
    Graph.FillColorRectangleF(ImgColor, RectF);
    ImageBox1.Image := Img;
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