首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >C++生成器2009迭代/递归窗体上的组件

C++生成器2009迭代/递归窗体上的组件
EN

Stack Overflow用户
提问于 2013-12-14 04:37:04
回答 1查看 129关注 0票数 0

我希望迭代/递归遍历表单上的组件。

我计划迭代/递归遍历组件,以对特定类型的组件进行批量更改,但为了这样做,我需要一个指向所有组件的句柄。

我检查了Code Complete和Google,但没有任何机会回答我自己的问题。

EN

回答 1

Stack Overflow用户

发布于 2013-12-15 03:09:20

使用TWinControl.Controls[]属性,例如:

代码语言:javascript
复制
Procedure DoSomething(AControl: TWinControl);
Var
  I: Integer;
  Ctrl: TControl;
Begin
  If AControl is TSomeControl then
  Begin
    ...
  End;
  For I := 0 to AControl.ControlCount-1 do
  Begin
    Ctrl := AControl.Controls[I];
    If Ctrl is TWinControl then
      DoSomething(TWinControl(Ctrl));
  End; 
End;

Procedure TMyForm.DoIt;
Begin
  DoSomething(Self);
End;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20575555

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档