unit Test;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, Graphics, StdCtrls;
type
TArt = (TaDreieckUl, TaDreieckUr, TaDreieckOl, TaDreieckOr);
type
TTest =
class(TLabel)
private
{ Private declarations }
FArt : TArt;
procedure SetArt(Value : TArt);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent);
override;
published
{ Published declarations }
property Aussehen : TArt
read FArt
write SetArt;
end;
procedure Register;
implementation
constructor TTest.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
end;
procedure TTest.SetArt(Value: TArt);
begin
if Value <> Aussehen
then
begin
if (Aussehen = TaDreieckUl)
or (Aussehen = TaDreieckOr)
then
begin
canvas.Brush.Color := clblack;
canvas.MoveTo(0,0);
canvas.LineTo(width,height);
if Aussehen = TaDreieckUl
then
canvas.FloodFill(1,10,clblack,fsborder)
else
canvas.FloodFill(10,1,clblack,fsborder)
end
else
begin
canvas.Brush.Color := clblack;
canvas.MoveTo(width,height);
canvas.LineTo(0,height);
if Aussehen = TaDreieckOl
then
canvas.FloodFill(1,10,clblack,fsborder)
else
canvas.FloodFill(10,1,clblack,fsborder)
end;
Aussehen := Value;
end;
end;
procedure Register;
begin
RegisterComponents('
Samples', [TTest]);
end;
end.