Making an AcceptButton border invisible

443 Views Asked by At

I am working on a project that is using a Victorian look and feel: enter image description here

The problem that I'm having is with the AcceptButton (or OK or default acceptance) button. Obviously, I can make the button transparent and I can set the borders to 0 width. The problem is that when this particular button (notice how the Cancel button doesn't have this problem) is marked as the AcceptButton it automatically draws a border around it.

Is there a property that I can set that will override this?

Thanks!

2

There are 2 best solutions below

4
Mariusz Jamro On

Subclass the Button and overide the ShowFocusCues property so that it returns False:

public class MyButton : Button
{

    protected override bool ShowFocusCues
    {
        get
        {
            return false;
        }
    }
}
2
zetar On

Got it. Here's the solution:

OKButton.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); //transparent