新加的属性必须用变量保存。
将
FComponentInit: TStrings;
0A写到private里面。
function TCustomPanel1.GetComponentInit:TStrings;
begin
result:=FComponentInit;
end;
procedure TCustomPanel1.SetComponentInit(s:TStrings);
begin
FComponentInit:=s;
end;—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”或者去掉';
I.Desire := '加不加分随你';
—————————————————————————————————
将
FComponentInit: TStrings;
0A写到private里面。
function TCustomPanel1.GetComponentInit:TStrings;
begin
result:=FComponentInit;
end;
procedure TCustomPanel1.SetComponentInit(s:TStrings);
begin
FComponentInit:=s;
end;—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”或者去掉';
I.Desire := '加不加分随你';
—————————————————————————————————
又是你,呵呵
哈哈,怎么啦?
我最近比较闲,所以……
—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”或者去掉';
I.Desire := '加不加分随你';
—————————————————————————————————
unit Button1;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TMyButton = class(TButton)
private
Fstr:TstringList;
{ Private declarations }
procedure SetStr(Str:TstringList);
protected
{ Protected declarations }
constructor Create(Aowner:Tcomponent);override;
destructor Destroy;override;
public
{ Public declarations }
published
{ Published declarations }
property items :TstringList read Fstr write SetStr;
end;
procedure Register;
implementation
constructor TMyButton.Create(Aowner:Tcomponent);
begin
inherited Create(Aowner);
if Not assigned(Fstr) then
Fstr:=TstringList.Create;
end;
destructor TMyButton.Destroy;
begin
if assigned(Fstr) then
Fstr.Free;
inherited Destroy;
end;
procedure TMyButton.SetStr(Str:TstringList);
begin
if assigned(Fstr) then
Fstr.Assign(Str);
end;
procedure Register;
begin
RegisterComponents('LZJ', [TMyButton]);
end;end.