Control.Select() 和 Control.Focus() 有什么区别? [英] What's the difference between Control.Select() and Control.Focus()?
问题描述
在 WinForms 中,要将焦点设置到特定控件,我似乎总是最终调用 Control.Select()
和 Control.Focus()
让它工作.
In WinForms, to set focus to a specific control, I always seem to wind up calling Control.Select()
and Control.Focus()
to get it to work.
有什么区别,这是正确的方法吗?
What is the difference, and is this the correct approach?
推荐答案
Focus 是一种低级方法,主要供自定义控件作者使用.相反,应用程序程序员应该对子控件使用 Select 方法或 ActiveControl 属性,或者对表单使用 Activate 方法.
Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focus.aspx
这篇关于Control.Select() 和 Control.Focus() 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!