Remove blue outlining of buttons

10.9k views Asked by At

Possible Duplicate:
How to set/change/remove focus style on a Button in C#?

Is there a way to remove the blue outlining when a button is pressed/was pressed/is active?

Here is a screenshot:

Blue outlining

Is there any way to hide it? I am using C# and winforms.

3

There are 3 answers

0
Jodrell On BEST ANSWER

Amalgamating the answers from the duplicate question

public class NoFocusCueButton : Button
{
    public NoFocusCueButton() : base()
    {
        InitializeComponent();

        this.SetStyle(ControlStyles.Selectable, false);
    }

    protected override bool ShowFocusCues
    {
        get
        {
           return false;
        }
    }
}
1
John Woo On

create a new class and inherit class Button, eg

public class OnetsButton : Button
{
    public OnetsButton()
    {
        this.SetStyle(ControlStyles.Selectable, false);
    }
}
0
Tim Kathete Stadler On

I have a solution now, it's not very sexy, but it works. I just added an invisible button to the form and now everytime a button is clicked, I select the invisible button. Works for me.