在程序中使用TButton的实例Btn
只要在implementation处声明
Var Btn:TButton;不就行了,怎么会出错?
只要在implementation处声明
Var Btn:TButton;不就行了,怎么会出错?
解决方案 »
- 请问为什么会出现Invalid variant type conversion
- 好书啊
- 【大龙驹】为父亲祈祷,散分.
- 诚请高人:怎么让RadioGroup里每一项的字符如lable般支持分行显示!急!
- 在delphi中怎么控制realone的播放阿!
- dbgrid的一个事件...
- 如何把低版本的程序升级到高版本?
- 挑战极限,高手请进!百分相赠!!!!
- 请问高手LISTBOX的SaveToFile能按行数保存为TXT文件吗?
- 关于delphi启动的问题。
- 怎么使一个窗口不能被最大化?怎么使窗口打开时处于屏幕中央?
- 下面的结果如何判空??adoQuery1.sql.add('select sum(number) as num from table1 where id='''+Edit1.text+'''');
还没有分配相应的地址空间
必须实例化
要注意的是
动态创建的必须释放
格式是
Btn:=Tbutton.create(owner);
try
dosomething;
finally
free;
end;
procedure TForm1.FormMouseDown(Sender:TObject;
Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
var
Btn:TButton;
begin
Btn:=TButton.Create(Self);
Btn.Parent:=Self;
Btn.Left:=X;
Btn.Top:=Y;
Btn.Width:=Btn.Width+50;
Btn.Caption:=Format('Button at %d,%d',[X,Y]);
end;
书上的例子
请教!
Delphi不同VC/C++所有对象都必须动态分配的Form一般式自动分配的,在DPR中有Application.,CreateForm实现的
[Error] sd.pas(29): Undeclared identifier: 'TButton'
是怎么回事?