Can I remove the dotted focus rectangle over tabs on a TabControl?

前端 未结 2 1487
旧巷少年郎
旧巷少年郎 2021-02-14 22:30

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 clic

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-14 22:48

    Set the focus to tab instead of header (like this)

    private void tabControl1_Click(object sender, EventArgs e)
    {
        (sender as TabControl).SelectedTab.Focus();
    }
    

    You will see dotted rectangle for a millisecond, as soon as the above event gets executed it will disappear.

    Also, to remove dotted rectangle for default selected tab on load

    private void tabControl1_Enter(object sender, EventArgs e)
    {
        (sender as TabControl).SelectedTab.Focus();
    }
    

    Both this changes worked for me! hope it helps somebody.

提交回复
热议问题