.netframeworksvisual-styles

WinForm Button on a black background appears invisible with Visual Styles disabled


i drop a Button on a black Form. The button appears fine at design time:

enter image description here

The button also appears fine at runtime (with Visual Styles enabled):

enter image description here

But the button draws completely wrong with visual styles disabled:

enter image description here

How to fix?

Bonus Chatter


Solution

  • I know this is an old post, but in case someone else comes across it, I managed to solve the issue in my program. In your Program.cs page (or whatever it's been renamed to), ensure you've called Application.EnableVisualStyles before calling Run.

    Application.EnableVisualStyles();
    Application.Run(new Form1());
    

    Also ensure that the button's UseVisualStyleBackColor property is set to true.