RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TBrush.Style Property

Specifies the pattern for the brush.

Pascal
property Style: TBrushStyle;
C++
__property TBrushStyle Style;

The Style property determines the pattern painted by the brush, unless a value is assigned to Bitmap.

Tip: Set the Style property to bsClear to eliminate flicker when the object repaints.
 

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) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!