Control.Focus()和Control.Select() [英] Control.Focus() and Control.Select()

查看:81
本文介绍了Control.Focus()和Control.Select()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以清楚地解释这句话吗?我想知道为什么对于应用程序程序员来说,使用Focus并不更好.谢谢.
焦点是主要用于自定义控件作者的低级方法.相反,应用程序程序员应该对子控件使用Select方法或ActiveControl属性,对窗体使用Activate方法."
这是链接: http://msdn.microsoft.com/en -us/library/system.windows.forms.control.focus.aspx
您可能需要向下滚动才能看到浅黄色的注释框.

Could someone explain this sentence clearly? I want to know why for application programmers, use Focus is not better. Thanks.
"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."
Here is the link:http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focus.aspx
You might have to scroll down to see the light yellow note box.

推荐答案

在这两种情况下,您都在告诉父表单将重点放在子表单上告诉孩子专注. b/c这可能是更好的选择,它更有可能在父级上引发正确的事件,或者类似的事情.我希望.
In both cases, you''re telling the parent form to focus on the child, instead of telling the child it is focused. This is probably better b/c it''s more likely to raise the right events on the Parent, or something like that, I expect.


这篇关于Control.Focus()和Control.Select()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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