有没有一种方法,使用户控件unfocussable? [英] Is there a way to make a UserControl unfocussable?

查看:135
本文介绍了有没有一种方法,使用户控件unfocussable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法,使用户控件unfocussable?

Is there a way to make a UserControl unfocussable?

编辑: 因此,的SetStyle(ControlStyles.Selectable,FALSE)

是要走的路。不过还是有区别控制。如果你继承的形式控制初始控制不失去焦点。但是,点击你的控制是从用户控件

is the way to go. But still there is difference to Control. If you inherit form Control the initial control does not lose focus. But after clicking on your control that is derived from UserControl and

ControlStyles.Selectable

应用重点从最初的控制中删除。

is applied focus is removed from initial control.

推荐答案

在你的构造后,的InitializeComponent()您需要调用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx"><$c$c>SetStyle并设置<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx"><$c$c>ControlStyles.Selectable风格

In your constructor after InitializeComponent() you need to call SetStyle and set the ControlStyles.Selectable style to false:

SetStyle(ControlStyles.Selectable, false);

这篇关于有没有一种方法,使用户控件unfocussable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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