IGxGraphics.FillColorRectangle

Syntax

FillColorRectangle(Color: IGxColor; Rect: IGxRect);

Parameters

Color. Color that is used to fill a rectangle.

Rect. Integer rectangle.

Description

The FillColorRectangle method fills the integer rectangle with the color passed by the Color parameter.

Fore 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;
    Graph: IGxGraphics;
    Rect: IGxRect;
    l, t, r, b: Integer;
Begin
    Img := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Format32bppArgb);
    ImgColor := GxColor.FromValue(Math.RandBetweenI(
0, Integer.MaxValue));
    l := Math.RandBetweenI(
0, Double.RoundInt(ImageBox1.ClientWidth / 2));
    t := Math.RandBetweenI(
0, Double.RoundInt(ImageBox1.ClientHeight / 2));
    r := Math.RandBetweenI(Double.RoundInt(ImageBox1.ClientWidth / 
2), ImageBox1.ClientWidth);
    b := Math.RandBetweenI(Double.RoundInt(ImageBox1.ClientHeight / 
2), ImageBox1.ClientHeight);
    Rect := 
New GxRect.Create(l, t, r, b);
    Graph := GxGraphicsClass.FromImage(Img);
    Graph.FillColorRectangle(ImgColor, Rect);
    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