单元一 U1(部分代码):.......
implementation
uses U2;
procedure TForm1.Button1Click(Sender: TObject);
var m:array[1..4] of TCheckBox;
k:integer;
begin
for k:=1 to 4 do
begin
with TCheckBox.Create(self) do
begin
parent:=U2.GroupBox2;
caption:='K'+IntToStr(k);
name:='qck'+ IntToStr(k);
left:=k*30;
top:=20;
end;
end;
end;单元二 U2......
implementation
uses U2;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=TForm1.ComponentCount-1 downto 0 do
begin
showMessage(TForm1.Components[i].Name);
end;
end;在弹出的控件名称当中,并没有qck1,qck2..等名称的checkBox,各位高手,这是为何?
implementation
uses U2;
procedure TForm1.Button1Click(Sender: TObject);
var m:array[1..4] of TCheckBox;
k:integer;
begin
for k:=1 to 4 do
begin
with TCheckBox.Create(self) do
begin
parent:=U2.GroupBox2;
caption:='K'+IntToStr(k);
name:='qck'+ IntToStr(k);
left:=k*30;
top:=20;
end;
end;
end;单元二 U2......
implementation
uses U2;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=TForm1.ComponentCount-1 downto 0 do
begin
showMessage(TForm1.Components[i].Name);
end;
end;在弹出的控件名称当中,并没有qck1,qck2..等名称的checkBox,各位高手,这是为何?
解决方案 »
- 如何做.CHM文件?
- 在动态设置数据库别名的时候,能指定数据库的相对路径吗?
- 感谢风雪同志的皮肤控件,特此奉送200,表示感谢
- 严重抗议:SydPink(希望不再敲键盘!)insert2003(高级打字员)进来
- 急!如果我要限制在一个edit1里面只能输入10位数字,怎么处理?
- Delphi把俺气死啦
- 初学者怎样才能学好DELPHI?介绍些好书吧!
- Delphi6三层结构下对clientdataset作ApplyUpdates不成功,请帮忙!!
- 怎样鼠标指向结点时将treeview中各结点显示不到的部分用类似HINT的方式显示出来
- 请问哪里可以下载到类似于spy+的程序?
- 读取数据库字段!!!
- 好久没散分了....节日快乐..
begin
showMessage(U2.GroupBox2.Components[i].Name);
end;
U2改为如下还是不行。......
implementation
uses U1;
procedure uForm.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=uForm.GroupBox2.ComponentCount-1 downto 0 do
begin
showMessage(uForm.GroupBox2.Components[i].Name);
end;
end;
GroupBox2.Control[index] 这样
同不懂.
一个工程中怎么会有两个同名而且互相引用的Form?
单元一 U1(部分代码): //动态生成checkBox....... implementation
uses U2;
procedure TForm1.Button1Click(Sender: TObject);
var m:array[1..4] of TCheckBox;
k:integer;
begin
for k:=1 to 4 do
begin with TCheckBox.Create(self) do
begin
parent:=U2.GroupBox2;
caption:='K'+IntToStr(k);
name:='qck'+ IntToStr(k);
left:=k*30;
top:=20;
end;
end;
end;单元二 U2 //获取动态生存的checkBox......
implementation
uses U1;
procedure uForm.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=uForm.GroupBox2.ComponentCount-1 downto 0 do
begin
showMessage(uForm.GroupBox2.Components[i].Name);
end;
end;
改成
TCheckBox.Create(uForm)
uses U1;
procedure uForm.Button1Click(Sender: TObject);
var i:integer;
begin
for i:= GroupBox2.ControlCount -1 downto 0 do
begin
showMessage(uForm.GroupBox2.Control[i].Name);
end;
end;GroupBox2 下的组件.