Question

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.

Was it helpful?

Solution

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;
        }
    }
}

OTHER TIPS

create a new class and inherit class Button, eg

public class OnetsButton : Button
{
    public OnetsButton()
    {
        this.SetStyle(ControlStyles.Selectable, false);
    }
}

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top