IGxGraphics.FillRectangle

Syntax

FillRectangle(Brush: IGxBrush; Rect: IGxRect);

Parameters

Brush. Brush.

Rect. Integer rectangle to be filled.

Description

The FillRectangle method fills the integer rectangle with the brush passed by the Brush parameter.

Fore Example

Executing the example requires a form with the button named Button1, the UiTabSheet1 non-visual component named UiTabSheet1, the TabSheetBox1 component named TabSheetBox1. Add links to the Drawing, Report, Tab system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    BMP: IGxBitmap;
    Graph: IGxGraphics;
    Brush: IGxBrush;
    Color: IGxColor;
    Rect: IGxRect;
    Picture: IPrxPicture;
Begin
    BMP := GxBitmap.CreateNew(200,100,GxPixelFormat.Format32bppArgb);
    Graph:= GxGraphicsClass.FromImage(BMP);
    // Create a rectangle, color and brush
    Rect := New GxRect.Create(0,0,200,200);
    Color := GxColor.FromKnownColor(GxKnownColor.Yellow);
    Brush := New GxSolidBrush.Create(Color);
    // Fills rectangle with the specified brush and sets high quality image
    Graph.FillRectangle(Brush,Rect);

    Graph.SmoothingMode := GxSmoothingMode.HighQuality;
    Picture := TabSheetBox1.Source.GetTabSheet.Objects.Add("PrxPicture"New GxRectF.Create(5,5,5,5)) As IPrxPicture;
    Picture.AutoSize := True;
    Picture.Image := BMP;
End Sub Button1OnClick;

Clicking the button in the TabSheetBox1 component renders yellow rectangle in the top left angle.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example

Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Report;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    BmpCls: GxBitmapClass = New GxBitmapClass();
    Bmp: GxBitmap;
    GraphCls: GxGraphicsClass = New GxGraphicsClassClass();
    Graph: GxGraphics;
    Rect: GxRect = New GxRectClass();
    ColorCls: GxColorClass = New GxColorClassClass();
    Color: GxColor;
    Brush: GxSolidBrush = New GxSolidBrushClass();
    RectF: GxRectF = New GxRectFClass();
    Picture: IPrxPicture;
Begin
    Bmp := BmpCls.CreateNew(200100, GxPixelFormat.pifFormat32bppArgb);
    Graph := GraphCls.FromImage(Bmp);
    //Create a rectangle, color and brush
    Rect.Create(00200200);
    Color := ColorCls.FromKnownColor(GxKnownColor.clBlack);
    Brush.Create(Color);
    // Fills rectangle with the specified brush and sets high quality image
    Graph.FillRectangle(Brush, Rect);
    Graph.SmoothingMode := GxSmoothingMode.gsmHighQuality;
    RectF.Create(5555);
    Picture := uiTabSheetNet1.TabSheetUi.TabSheet.Objects.Add("PrxPicture", RectF) As  IPrxPicture;
    Picture.AutoSize := True;
    Picture.Image := BMP;
End Sub;

See also:

IGxGraphics