积极答复者
Control.GetNextControl 微软帮助的错误

问题
-
这个方法微软的官方解释是:
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.chs/fxref_system.windows.forms/html/eb9e9a29-059f-2019-8fca-d0a21ec242c7.htm
GetNextControl 方法取决于 Tab 键顺序。要循环访问窗体的所有控件(包括嵌套控件),请使用 Controls 属性。要获取或设置容器控件的活动控件,请使用 ActiveControl 属性。
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.getnextcontrol.aspx
The GetNextControl method is dependent on tab order. To iterate through all controls of a form, including nested controls, use the Controls property. To get or set the active control of a container control, use the ActiveControl property.
实际上,这个方法可以递归控件下的所有控件(包含嵌套控件)。Controls只能获取该控件下的第一级控件(不包含嵌套控件)。
答案
-
你好!mazhou!
我开始也是你那样理解的,但是你看看文档中Controls属性的描述,这里并非是表达问题,这里文档存在错误:
中文:使用 Controls 属性可循环访问窗体的所有控件,包括嵌套控件。 使用 GetNextControl 方法可以按 Tab 键顺序检索上一个或下一个子控件。 使用 ActiveControl 属性可以获取或设置容器控件的活动控件。
英文:Use the Controls property to iterate through all controls of a form, including nested controls. Use the GetNextControl method to retrieve the previous or next child control in the tab order.
参考:
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.control.controls.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls.aspx
这段描述没有你说的那种表述歧义,可见这里文档描述的有错误!
周雪峰- 已标记为答案 KeFang Chen 2010年6月18日 3:11
全部回复
-
你好!mazhou!
我开始也是你那样理解的,但是你看看文档中Controls属性的描述,这里并非是表达问题,这里文档存在错误:
中文:使用 Controls 属性可循环访问窗体的所有控件,包括嵌套控件。 使用 GetNextControl 方法可以按 Tab 键顺序检索上一个或下一个子控件。 使用 ActiveControl 属性可以获取或设置容器控件的活动控件。
英文:Use the Controls property to iterate through all controls of a form, including nested controls. Use the GetNextControl method to retrieve the previous or next child control in the tab order.
参考:
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.control.controls.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls.aspx
这段描述没有你说的那种表述歧义,可见这里文档描述的有错误!
周雪峰- 已标记为答案 KeFang Chen 2010年6月18日 3:11