unit Pfeil;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TRichtung =(Links,Rechts,Unten,Oben);
type
TPfeil =
class(TGraphicControl)
private
{ Private-Deklarationen }
GetRichtung : TRichtung;
GetVisible : Boolean;
GetColor : TColor;
procedure SetRichtung(value:TRichtung);
procedure SetVisible(value:Boolean);
procedure SetColor(value:TColor);
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
protected
{ Protected-Deklarationen }
procedure Paint;
override;
published
{ Published-Deklarationen }
property Richtung: TRichtung
read getRichtung
write setRichtung;
property Visible: Boolean
read GetVisible
write SetVisible;
property Color: TColor
read GetColor
write SetColor;
property AutoSize;
end;
procedure Register;
implementation
{$R Pfeil.res}
procedure Register;
begin
RegisterComponents('
AfwBackup', [TPfeil]);
end;
procedure TPfeil.SetColor(value:TColor);
begin
if Value <> GetColor
then begin
GetColor := Value;
invalidate;
end;
end;
procedure TPfeil.SetRichtung(value:TRichtung);
begin
if Value <> GetRichtung
then begin
GetRichtung := Value;
invalidate;
end;
end;
procedure TPfeil.SetVisible(value:Boolean);
begin
if Value <> GetVisible
then begin
GetVisible := Value;
invalidate;
end;
end;
constructor TPfeil.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Height:=25;
Width:=25;
GetVisible:=true;
GetColor:=clblack;
GetRichtung:=Links;
end;
procedure TPfeil.Paint;
begin
if Visible
then
with Canvas
do begin
pen.color:=Color;
brush.color:=Color;
{ Pfeil zeichnen }
case GetRichtung
of
Oben : Polygon([Point(0,height),Point(width
div 2,0),Point(width,height)]);
Unten : Polygon([Point(0,0),Point(width
div 2,height),Point(width,0)]);
Rechts : Polygon([Point(0,0),Point(width,height
div 2),Point(0,height)]);
Links : Polygon([Point(width,0),Point(0,height
div 2),Point(width,height)]);
end;
end;
end;
end.