我可以删除TabControl上的选项卡上的虚线焦点矩形? [英] Can I remove the dotted focus rectangle over tabs on a TabControl?

查看:250
本文介绍了我可以删除TabControl上的选项卡上的虚线焦点矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经将TabControl的TabStop属性设置为false。然而,如果我点击一个标签,然后按下 Tab 键,虚线的矩形会出现在tabname的周围。



I尝试创建我自己的 TabControl ,并试过这个


$ b $ pre> class MyTabControl:TabControl
{
public MyTabControl()
{
TabStop = false;
DrawMode = TabDrawMode.OwnerDrawFixed;
DrawItem + =新的DrawItemEventHandler(DoMoreTabControl_DrawItem);
Invalidate();






$ b

然而,虚线矩形仍然出现。



我也尝试覆盖 MyTabControl.OnPaint()方法,但是没有帮助。



有什么办法可以达到这个目的?

解决方案

DrawItem事件。你没有发布,不可能猜到它有什么问题。只要确保不要调用复制MSDN示例代码时可能出现的 e.DrawFocusRectangle()。简单地删除这个陈述就足够了。考虑使用不同的背景颜色或文本字体样式作为替代方案,以便焦点提示不会完全丢失。


I have a tab control and need to remove the dotted focus rectangle around the selected tab.

I have set the TabStop property of the TabControl to false. However if I click on a tab and press the Tab key, the dotted rectangle appears around the tabname.

I have tried creating my own TabControl and tried this

class MyTabControl : TabControl
{
        public MyTabControl()
        {
            TabStop = false;
            DrawMode = TabDrawMode.OwnerDrawFixed;
            DrawItem += new DrawItemEventHandler(DoMoreTabControl_DrawItem);
            Invalidate();
        }
}

However, the dotted rectangle still appears.

I also tried overriding the MyTabControl.OnPaint() method but it doesn't help.

Is there any way to achieve this?

解决方案

Yes, DrawItem event. You didn't post it, impossible to guess what's wrong with it. Just make sure that you don't call e.DrawFocusRectangle(), likely to present when you copied the MSDN sample code. Simply deleting the statement is sufficient. Consider using a different background color or text font style as an alternative so the focus hint isn't entirely lost.

这篇关于我可以删除TabControl上的选项卡上的虚线焦点矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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