Declaration
procedure FillRect(const Rect: TRect); overload;
procedure FillRect(const Rect: TRect; Color: TColor); overload;
Description
Fill an area with the current
current brush.
With second overload, a solid color brush is used.
GDI+ Method:
GdipFillRectangle
Also see:
GradientFillRect
Note: The Rect.Right and Rect.Bottom points are excluded from the painting
// Highlight an area of a bitmap
iec := TIECanvas.Create( Bitmap.Canvas, false );
iec.Brush.Color := clRed;
iec.Brush.Style := bsSolid;
iec.Brush.Transparency := 125;
iec.FillRect( Rect( 650, 680, 850, 780 ));
iec.Free();

// Create an alpha gradient image
var
ieBmp: TIEBitmap;
r: TRect;
begin
ieBmp := TIEBitmap.Create(320, 240, clWhite );
try
r := ieBmp.IECanvas.GDICanvas.ClipRect;
InflateRect( r, 1, 1 ); // Because Fill may smooth edges
// Fill image with purple
ieBmp.IECanvas.FillRect( r, clPurple );
// Draw gradient to our alpha channnel
ieBmp.AlphaChannel.PixelFormat := ie24RGB; // Temporary promote the alpha channel to 24bit to get smoother gradient
ieBmp.AlphaChannel.IECanvas.GradientFillRect( r, clWhite, clBlack, gpgDiagonal );
ieBmp.SyncAlphaChannel(); // Now revert alpha to ie8g
ieBmp.SaveToFile( 'D:\AlphaGradient.png' );
finally
ieBmp.Free;
end;
end;
