unit TControlColor;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ToolWin, ComCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ColorDialog1: TColorDialog;
    Shape1: TShape;
    ToolBar1: TToolBar;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: TControlColor
// Method: Dialogs.TColorDialog.Execute
// Property: Dialogs.TColorDialog.Color
// Property: Controls.TControl.Color

// BeginCode
{
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;
// EndCode
// EndExample: TControlColor
end.
