문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top