unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, LCLIntf;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
ColorDialog1: TColorDialog;
procedure Button1Click(Sender: TObject);
procedure ShapeMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject); // Make empty palette
var shape: TShape;
begin
shape := TShape.Create(Self);
shape.Parent := Form1;
shape.Left := 100;
shape.Top := 100;
shape.Width := 20;
shape.Height := 20;
shape.Pen.Width := 1;
shape.Pen.Color:=clBlack;
shape.Brush.Color:=clDefault;
shape.Visible := True;
shape.Enabled := True;
shape.OnMouseUp := ShapeMouseUp;
end;
procedure TForm1.ShapeMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if ColorDialog1.Execute then
(Sender as TShape).Brush.Color:=ColorDialog1.Color;
end;
end.