unit MyLabel;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMyShape=(msLine,msRect,msEllipse);
TMyLabel = class(TGraphicControl)
private
FMyShape:TMyShape;
procedure SetShape(value:TMyShape);
protected
Constructor Create(AOwner:TComponent);override;
public
procedure paint;override;
published
property MyShape:TMyShape read FMyShape write SetShape Default msLine;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Expand', [TMyLabel]);
end;
{ TMyLabel }
constructor TMyLabel.Create(AOwner: TComponent);
begin
inherited;
height:=50;
width:=50;
FMyShape:=msLine;
end;
procedure TMyLabel.paint;
begin
inherited;
with Canvas do begin
case FMyShape of
msline: begin
Moveto(height div 2,0);
lineto(height div 2,width);
end;
msRect:
Rectangle(0,0,width,height);
msEllipse:
Ellipse(0,0,width,height);
end;
end;
end;
procedure TMyLabel.SetShape(value: TMyShape);
begin
if FmyShape<>value then
FMyShape:=value;
end;
end.