Panel.TabStop = true 没有效果
我尝试将 Panel.TabStop
属性切换为 true
但它不会影响任何内容。
如何在Panel
中启用TabStop
?
I Trying to switch Panel.TabStop
property totrue
but it does not affect anything.
How to enable TabStop
in a Panel
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
TabStop 属性对 Panel 控件没有影响,因为它是一个容器对象。
查看此 MSDN 链接了解详细信息。
The TabStop property has no effect on the Panel control as it is a container object.
Checkout this MSDN Link for details.
正如其他人所说,面板控件不会接受焦点。但是,如果将 TabStop 设置为 true 并设置其 TabOrder,则 TabOrder 中的下一个控件应该获得焦点。
As the others have said, the panel control will not accept focus. However, if you set TabStop to true and set its TabOrder, then the next control in the TabOrder should receive focus.
面板不接受键盘焦点,因为面板本身不是控件,它是可能接受键盘焦点的其他控件的容器。
如果您尝试创建自定义控件,请从 UserControl 或 Control 派生。
A Panel does not accept keyboard focus because a Panel is not a control (per se), it's a container for other controls which probably accept keyboard focus.
If you're trying to create a custom control, derive from UserControl or Control.
据我了解,TabStop 属性存在于控件级别,但它实际上只影响我所说的交互式控件(可能有一个实际的、正确的术语)。由于面板无法直接接收焦点,因此它们不会根据该标志有不同的行为。
As I understand it, the TabStop property exists at the control level, but it really only affects what I would call interactive controls (there's probably an actual, correct term). Since panels can't directly receive the focus, they won't behave differently based on that flag.
你必须放置一些可以接受焦点的东西,比如编辑框。就这样吧:)
You have to put something that can accept focus onto it, like editbox. There you go :)
尝试为您正在使用的面板设置
Focusable=true
。Try setting
Focusable=true
for the Panel you are using.