How can I fill a selected area with color?
var Rect: TRect;
Color: TColor;
begin
//fill area with color
end;
You have not stated what you mean by custom area and you talk about a "selected area". I don't know what you mean.
For a simple rectangle then you typically would fill the rectangle with TCanvas.FillRect
.
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := Color;
Canvas.FillRect(R);
where R
is a TRect
specifying the rectangle.
For a more complex region then you need to fall back on the Windows GDI function FillRgn
. This function is not wrapped by TCanvas
but you can simply call it passing TCanvas.Handle
as the HDC
.