Hallo,
hier nochmal mit property. Warum die Routine das alte caption nicht zeichnet ist mir unklar.
Aus diesem Grund habe ich das neue property utext_label eingeführt. Vielleicht kann hier jemand helfen.
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tlabel_new=class (Tlabel)
procedure paint;
override;
private
{ Private-Deklarationen }
utext_label:
string;
procedure Settext_label(
const Value:
string);
public
{ Public-Deklarationen }
published
{ Published-Deklarationen }
property Text_label :
string read utext_label
write Settext_label;
end;
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
t:tlabel_new;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure Tlabel_new.Settext_label(
const Value:
string);
begin
utext_label:=value;
paint;
end;
procedure Tlabel_new.paint;
var r:trect;
begin
inherited;
r.Left:=1;
r.Top:=1;
r.Bottom:=height;
r.Right:=width;
Canvas.rectangle(r);
Caption:=utext_label;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
t:=tlabel_new.Create(self);
t.parent:=self;
t.utext_label:='
Hallo'
end;
end.
Gruss Rainer