我从edit控件继承写了一个自定义组件,我是如下编写的,但是编译的时候系统在create上提示“warning ",并且安装后,组件的create明显没有起作用,这是怎么回事呀?
type
TMyEdit = class(TEdit)
private
FContent:String;
function GetContent():String;
procedure SetContent(value:String);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);
procedure Demo(Str:String);
procedure OnChange();
published
property Content:String read GetContent write SetContent;
{ Published declarations }
end;procedure Register;implementationConstructor TMyEdit.Create(AOwner:Tcomponent);
begin
inherited create(AOwner);
Text:='okokok';
end;procedure Register;
begin
RegisterComponents('Samples', [TMyEdit]);
end;function TMyEdit.GetContent():String;
begin
result:=FContent;
end;procedure TMyEdit.SetContent(value:String);
begin
FContent:=value;
end;procedure TMyEdit.Demo(str:String);
begin
Text:=str+'*'+str;
end;
type
TMyEdit = class(TEdit)
private
FContent:String;
function GetContent():String;
procedure SetContent(value:String);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);
procedure Demo(Str:String);
procedure OnChange();
published
property Content:String read GetContent write SetContent;
{ Published declarations }
end;procedure Register;implementationConstructor TMyEdit.Create(AOwner:Tcomponent);
begin
inherited create(AOwner);
Text:='okokok';
end;procedure Register;
begin
RegisterComponents('Samples', [TMyEdit]);
end;function TMyEdit.GetContent():String;
begin
result:=FContent;
end;procedure TMyEdit.SetContent(value:String);
begin
FContent:=value;
end;procedure TMyEdit.Demo(str:String);
begin
Text:=str+'*'+str;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货