RAD Studio VCL Reference
|
Specifies the background color of the control.
property Color: TColor;
__property TColor Color;
Use Color to read or change the background color of the control.
If a control's ParentColor property is true, then changing the Color property of the control's parent automatically changes the Color property of the control. When the value of the Color property is changed, the control's ParentColor property is automatically set to false.
C++ Examples:
/* The following code changes the color of a shape control using the Color dialog box. The example displays the Color dialog box when the Button1 button is clicked, allowing the user to select a color with the dialog box. When a color value is selected with the dialog box, it is assigned to the shape control. */ void __fastcall TForm1::Button1Click(TObject *Sender) { if (ColorDialog1->Execute()) Shape1->Brush->Color = ColorDialog1->Color; }
Delphi Examples:
{ The following code changes the color of a shape control using the Color dialog box. The example displays the Color dialog box when the Button1 button is clicked, allowing the user to select a color with the dialog box. When a color value is selected with the dialog box, it is assigned to the shape control. } procedure TForm1.Button1Click(Sender: TObject); begin if ColorDialog1.Execute then Shape1.Brush.Color := ColorDialog1.Color; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|