表单上的所有控件不使用递归 [英] All Controls On Form Without Using Recursion

查看:71
本文介绍了表单上的所有控件不使用递归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不使用递归方法的情况下将所有控件及其所有子项放在

Windows窗体上?

Is it possible to get all controls and all of their children on a
Windows form without using recursive methods ?

推荐答案

"每个递归函数都可以使用堆栈转换为一个迭代函数。

所以,是的,这是可能的。


" inpuarg" < in ***** @whereland.comha scritto nel messaggio

新闻:a2 ************************ ******** @ 4ax.com ...
"Every recursive function can be transformed into an iterative function by
using a stack."
So, yes it is possible.

"inpuarg" <in*****@whereland.comha scritto nel messaggio
news:a2********************************@4ax.com...

是否可以将所有控件及其所有孩子放在

不使用递归方法的Windows窗体?
Is it possible to get all controls and all of their children on a
Windows form without using recursive methods ?



你能举个例子吗?


2007年2月1日星期四11 :24:33 + 0100,Laura T. < LT@NOWHERE.COMwrote:
would you please give me an example ?

On Thu, 1 Feb 2007 11:24:33 +0100, "Laura T." <LT@NOWHERE.COMwrote:

>"每个递归函数都可以通过堆栈转换为迭代函数。 br />所以,是的,这是可能的。

" inpuarg" < in ***** @whereland.comha scritto nel messaggio
新闻:a2 **************************** ****@4ax.com ..
>"Every recursive function can be transformed into an iterative function by
using a stack."
So, yes it is possible.

"inpuarg" <in*****@whereland.comha scritto nel messaggio
news:a2********************************@4ax.com.. .

>是否可以在不使用递归方法的情况下将所有控件及其所有子项放在Windows窗体上?
>Is it possible to get all controls and all of their children on a
Windows form without using recursive methods ?


private void ResetAllControlsBackColor(Control control)

{

control.BackColor = SystemColors.Control;

if(this.HasChildren)

{

//为每个子控件递归调用此方法。

foreach(控制childControl in control.Controls)

{

ResetAllControlsBackColor(childControl);

}


这一个 - 例如?

On Thu,2007年2月1日11:24:33 +0100,Laura T. < LT@NOWHERE.COMwrote:
private void ResetAllControlsBackColor(Control control)
{
control.BackColor = SystemColors.Control;
if(this.HasChildren)
{
// Recursively call this method for each child control.
foreach(Control childControl in control.Controls)
{
ResetAllControlsBackColor(childControl);
}

this one - for example ?
On Thu, 1 Feb 2007 11:24:33 +0100, "Laura T." <LT@NOWHERE.COMwrote:

>"每个递归函数都可以通过堆栈转换为迭代函数。 br />所以,是的,这是可能的。

" inpuarg" < in ***** @whereland.comha scritto nel messaggio
新闻:a2 **************************** ****@4ax.com ..
>"Every recursive function can be transformed into an iterative function by
using a stack."
So, yes it is possible.

"inpuarg" <in*****@whereland.comha scritto nel messaggio
news:a2********************************@4ax.com.. .

>是否可以在不使用递归方法的情况下将所有控件及其所有子项放在Windows窗体上?
>Is it possible to get all controls and all of their children on a
Windows form without using recursive methods ?


这篇关于表单上的所有控件不使用递归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆