sh:TControl;
begin
sh:=grp1.FindChildControl('shape1');
if grp1.FindChildControl('shape1')<>nil then
ShowMessage('sss');
end;
为什么找不到shape呢,而返回值是Nil
...全文
2149打赏收藏
关于FindChildControl方法,马上揭帖!!!!
我在一个groupbox 中放入几个shape var sh:TControl; begin sh:=grp1.FindChildControl('shape1'); if grp1.FindChildControl('shape1')nil then ShowMessage('sss'); end; 为什么找不到shape呢,而返回值是Nil
xixuemao(动感超淫) :
我有看过Help
a control's children 是如何定义的呢,是指Pearent,还是Owner?
我实际上把shape放在了Groupbox里,而GroupBox又放在Form上,并且
Shape和GroupBox都是动态生成的,那我该如何操作shape?
FindChildControl only locates immediate children of the control.
It can't find a control that is a child of one of the control's children.//重点在这句
看看这个注视吧,你直接把shape放到form上,然后
procedure TForm1.Button1Click(Sender: TObject);
begin
if assigned(self.FindChildControl('button2')) then
ShowMessage('sss');
end;