RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TBrush.Color Property

Indicates the color of the brush.

Pascal
property Color: TColor;
C++
__property TColor Color;

The Color property determines the color of the brush. This is the color that is used to draw the pattern represented by the Style property, not the background color of the brush (unless Style is bsSolid).

Note: If the value of the Style property is bsClear, the Color property is ignored. Further, any value assigned to the Color property is lost when Style is set to bsClear.
 

C++ Examples: 

 

/*
The following example paints a cross-hatched ellipse onto 
Image1 which is a TImage on the form when the user clicks on
Button1.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TCanvas *pCanvas = Image1->Canvas;
  pCanvas->Brush->Color = clRed;
  pCanvas->Brush->Style = bsDiagCross;
  pCanvas->Ellipse(0, 0, Image1->Width, Image1->Height);
}

 

Delphi Examples: 

{
The following example paints a cross-hatched ellipse onto 
Image1 which is a TImage on the form when the user clicks on
Button1.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
  with Image1 do begin
    Canvas.Brush.Color := clRed;
    Canvas.Brush.Style := bsDiagCross;
    Canvas.Ellipse(0, 0, Image1.Width, Image1.Height);
  end;
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!