关于Application.ComponentCount 的问题 for i := 0 to Application.ComponentCount - 1 do begin ... end;这个Application.ComponentCount 到底指的是哪些组件的个数总和,包括不包括非auto-create的form及其上面的组件. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 包括所有生成的form,但不包括组件,另外还有一个系统window测试:var i:integer;beginfor i:=0 to application.ComponentCount-1 doshowmessage(application.Components[i].ClassName)end; 比如,主窗体是form1,我动态创建了form2,form2上面有一个edit,这个edit算不算? 只包括生成的FORM,不包括组件。form2上面的edit组件不算。刚刚测试过 来晚了。包括以Application为直接宿主的所有控件。 同意楼上var T:Tedit;begin T:=Tedit.Create(nil); T.Parent:=self;end;这个动态的不包括var T:Tedit;begin T:=Tedit.Create(application); T.Parent:=self;end;这个包括 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;type TForm1 = class(TForm) BitBtn1: TBitBtn; procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);var i:integer;beginshowmessage(inttostr(application.Componentcount));for i:=0 to application.ComponentCount-1 doshowmessage(application.Components[i].ClassName);end;end.结果show出来的是2个,一个是tform,一个是thintwindow?后者是什么?每次都会自动创建吗/ delphi 如何用socket发送和接收二进制数据 我问大家一个菜鸟问题,是关于串口读写的。 对于阿日的那个什么常用软件的质疑,感觉甚为无聊,这里鄙视之一。 我动态创建表,里面有个备注型的字段,然后向表里插值,但备注型的总是出问题!! 在线等待!!!!急!!!!!! delphi 2010 首拼函数不能用 抓屏问题!100分 没有手机,怎样通过互联网给别人的手机发短信?当然最好不要太费事的,免费就更好了 一个古怪的报表问题! 有关delphi调用和保存excel文档的问题? 怎样判断窗体是否处于最大化(全屏)?? 如何在FastReport中给 MasterData定位??
var i:integer;
begin
for i:=0 to application.ComponentCount-1 do
showmessage(application.Components[i].ClassName)
end;
form2上面的edit组件不算。
刚刚测试过
包括以Application为直接宿主的所有控件。
begin
T:=Tedit.Create(nil);
T.Parent:=self;
end;
这个动态的不包括
var T:Tedit;
begin
T:=Tedit.Create(application);
T.Parent:=self;
end;
这个包括
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var i:integer;
begin
showmessage(inttostr(application.Componentcount));
for i:=0 to application.ComponentCount-1 do
showmessage(application.Components[i].ClassName);
end;
end.
结果show出来的是2个,一个是tform,一个是thintwindow?后者是什么?每次都会自动创建吗/