简体   繁体   中英

Form Button disabled appearance

I have a series of buttons which I enable and disable programmatically for various reasons. I was unhappy with the default appearance of a disabled button. So I modified my code to also change the BackColor when it disables a button. This works, but now the button has a thick grey border when it is disabled. I tried changing the BorderColor and the Border size, but this has no effect. How can I get rid of the border?

this.EditButton.Enabled = false;
this.EditButton.BackColor =  ColorTranslator.FromHtml(ControlColours.DisabledButtonBackColour);
this.EditButton.BorderColor = ColorTranslator.FromHtml(ControlColours.DisabledButtonBackColour);
this.EditButton.FlatAppearance.BorderSize=0;

Instead of

this.EditButton.BorderColor = ColorTranslator.FromHtml(ControlColours.DisabledButtonBackColour);

this one

this.EditButton.FlatStyle = FlatStyle.Flat;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM