http://topic.csdn.net/u/20080317/17/67137d08-73f6-4724-8ba9-18cd54bd89d1.html?81903143
这个贴子里,修改了之后单击button会提示“A component named button3 already exists”,请问怎样方便的Free或Destroy所有的已创建的button?以避免这个错误。谢谢
这个贴子里,修改了之后单击button会提示“A component named button3 already exists”,请问怎样方便的Free或Destroy所有的已创建的button?以避免这个错误。谢谢
解决方案 »
- 高分求:怎么用delphi实现把一系列的jpg转avi啊,谁能提供一下代码
- 老板出差归来.....
- 这个错误什么意思?
- 我也不知道怎么找到的这个地方……
- 难道没高手能回答我这问题吗?
- 存储过程的问题!200分!
- ***一个奇怪的小问题!!
- 关于delphi 2010 TSQLConnection 连接SQL Server2000 问题
- 如何在DELPHI6。0中做一个简易的浏览器
- '应用程序服务器'的简单问题
- 如何保存用ADO查询出来的DBF表中的数据(关于into dbf...)
- 现在窗体上有一系列的RadioButton,如何遍历这些RadioButton,并将他们的Checked属性改为false???? 谢谢大家了
if Button1=nil then
Button1:=TButton.Create(Self); //在这里建立新的
//再根据属性进行设置其他参数
if SameText(Components[i].ClassName, 'TButton') then
Components[i].Free;
end;
当button多的时候我试着一个一个的Free掉 但太浪费时间了 还不如重启快,有没有好的办法呢?前提是不能让程序重启
var
Buttontemp:TButton;
begin
Buttontemp:=TButton(FindComponent(Edit1.Text));
if Buttontemp<>nil then
begin
Buttontemp.Width:=strtointdef(Edit2.Text,75);
Buttontemp.Height:=strtointdef(Edit3.Text,25);
end
else
begin
Buttontemp:=TButton.Create(Self); //在这里建立新的
Buttontemp.Name:=Edit1.Text;
Buttontemp.Left:=100;
Buttontemp.Top:=200;
Buttontemp.Width:=strtointdef(Edit2.Text,75);
Buttontemp.Height:=strtointdef(Edit3.Text,25);
Buttontemp.Parent:=self;
end;
end;
在窗体上就建button1、button2、button3Button2Click的代码是Button1.Free;
Button3Click的代码是Button1.Create(self);按button2后button1可以消失,但为什么按button3的时候会出错?求教各位高手,应该如何修改,谢谢。
Button1.Parent:=self;
Button1.Caption:='Button1';
Button1.Left:=0;
Button1.Top:=0;如何有销毁Button1呢?改变其属性,就可以立即生效。如在Button2的Click中写
button1.width:=100;
button2.height:=200;
难道button1的宽高没有改变吗?