表单上的所有控件不使用递归
问题描述:
是否可以在不使用递归方法的情况下将所有控件及其所有子项放在
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 ?