C
Cando
Unregistered / Unconfirmed
GUEST, unregistred user!
我编写了如下VCL代码,想用LoadFromFile的,可是ADVMemo.LoadFromFile看不到.程序如下:
unit AdvMemo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TAdvMemo = class(TMemo)
private
{ Private declarations }
Procedure LoadFromFile(const AFileName:String);
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
Procedure TAdvMemo.LoadFromFile(const AFileName:String);
var
f:TextFile;
str:String;
begin
AssignFile(f,AFileName);
Reset(f);
try
while not Eof(f) do
begin
Readln(f,str);
Lines.Add(str);
end;
finally
CloseFile(f);
end;
end;
procedure Register;
begin
RegisterComponents('DDG', [TAdvMemo]);
end;
end.
[?]
unit AdvMemo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TAdvMemo = class(TMemo)
private
{ Private declarations }
Procedure LoadFromFile(const AFileName:String);
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
Procedure TAdvMemo.LoadFromFile(const AFileName:String);
var
f:TextFile;
str:String;
begin
AssignFile(f,AFileName);
Reset(f);
try
while not Eof(f) do
begin
Readln(f,str);
Lines.Add(str);
end;
finally
CloseFile(f);
end;
end;
procedure Register;
begin
RegisterComponents('DDG', [TAdvMemo]);
end;
end.
[?]