问题描述
我有关于C#我的大学的测试中一个问题。 标签能得到一个焦点?的,我可以在MSDN网站上看到,所有控件都可以得到一个重点,但他们中的一些不可选。因此它在我看来,正确的答案是标签可以得到一个重点,但无法选择。另外标签有一个焦点()方法。请帮助我了解。感谢名单。
I have a one question on my university's test about C#. Could label get a focus? As I can see on MSDN site, all Controls can get a focus, but some of them aren't selectable. So it's seems to me that the right answer is "Label could get a focus, but couldn't be selected". Also Label has a Focus() method. Please, help me understand. Thanx.
推荐答案
是有上标注焦点()
方法是的,它是它的工作原理完全正确的;但不同的表现。让我尝试解释
Yes there is a Focus()
method on Label and yes it is absolutely right it works; but behave differently. let me try to explain
标签可以用一些一个输入控件关联,例如一个用户名文本字段标签,所以相关联的控制
与标签的概念。 AssociatedControlID MSDN上
A Label can be associated with some one input control, for instance a label for a user name text field, so there is concept of Associated Control
with the label. AssociatedControlID on msdn
所以,你可以用一个标签输入控件关联,每当标签被选中传递给相关的输入控件。
So you can associate an input control with a label and whenever label is selected the control passed to the associated input control.
例这里在登录框中单击电子邮件或密码标签,看看发生了什么,同样,如果你调用对焦方式标签上的焦点将传递给相关联的控制。
Example here click on Email or Password labels in login box and see what happened, similarly if you call focus method on the label the focus will passed to the associated control.
这篇关于难道标签获得焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!