S sljyt Unregistered / Unconfirmed GUEST, unregistred user! 2006-05-25 #1 点击一个button1,动态生成一个Panel1,这个panel1上有一个button2,要求点击button2的时候将panel1完全释放掉.要求不能弹出如Abstract Error等错误提示.
W wrl_001 Unregistered / Unconfirmed GUEST, unregistred user! 2006-05-25 #2 简单 procedure TForm1.BtnClick(Sender: TObject); var w:TWinControl; begin//重点这里要先备份,然后修改Parent w:=TButton(Sender).Parent; TButton(Sender).Parent :=nil; w.Free; end; procedure TForm1.Button1Click(Sender: TObject); var pan:TPanel; btn:TButton; begin Pan:=TPanel.Create(self); pan.Parent :=self; btn:=TButton.Create(self); btn.Parent :=pan; btn.OnClick :=btnClick; end;
简单 procedure TForm1.BtnClick(Sender: TObject); var w:TWinControl; begin//重点这里要先备份,然后修改Parent w:=TButton(Sender).Parent; TButton(Sender).Parent :=nil; w.Free; end; procedure TForm1.Button1Click(Sender: TObject); var pan:TPanel; btn:TButton; begin Pan:=TPanel.Create(self); pan.Parent :=self; btn:=TButton.Create(self); btn.Parent :=pan; btn.OnClick :=btnClick; end;