谁能解释这段代码为什么不行(代码完整,直接可粘贴到Delphi中测试,花不了高手太多时间的)
请给出原因和解答
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tfrm = class(TForm)
private
FParentRect: TRect;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property ParentRect: TRect read FParentRect write FParentRect;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Ffrm: Tfrm;
implementation
{$R *.dfm}
constructor Tfrm.Create(AOwner: TComponent);
begin
inherited;
end;
destructor Tfrm.Destroy;
begin
inherited;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not Assigned(Ffrm) then
begin
Ffrm := Tfrm.Create(self);
Ffrm.Parent := self;
end;
Ffrm.Show;
end;
end.