unit LabelPanel;
interface
uses
SysUtils, Classes, Controls, StdCtrls, ExtCtrls;
type
TLabelPanel =
class(TPanel)
private
FLabel: TLabel;
FOnLabelClick: TNotifyEvent;
{ Private-Deklarationen }
protected
procedure LabelClick(Sender: TObject);
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
published
{ Published-Deklarationen }
property OnLabelClick: TNotifyEvent
read FOnLabelClick
write FOnLabelClick;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Cruiser', [TLabelPanel]);
end;
{ TLabelPanel }
constructor TLabelPanel.Create(AOwner: TComponent);
begin
inherited;
FLabel := TLabel.Create(self);
FLabel.Parent := Self;
FLabel.Top := 4;
FLabel.Left := 4;
FLabel.Caption := '
blah';
FLabel.Transparent := True;
FLabel.Font.Color := $000000FF;
FLabel.OnClick := LabelClick;
FLabel.Show;
end;
destructor TLabelPanel.Destroy;
begin
FLabel.Free;
inherited;
end;
procedure TLabelPanel.LabelClick(Sender: TObject);
begin
if Assigned(FOnLabelClick)
then
FOnLabelClick(Sender);
end;
end.