Search code examples
c#winformsuser-interfacebuttonoutlining

Remove blue outlining of buttons


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.


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