Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you modify the appearance of a disabled button in vb.net?

I'm disabling a button in vb.net and when I do, I cannot control the BackColor or ForeColor properties to change the appearance. I set new values for them but they don't get picked up. The disabled button looks almost exactly like my enabled buttons so you can't tell the difference. I'm using Flat Style buttons, but have tried changing this and it still doesn't seem to work. Is there some sort of trick to be able to do this?

like image 892
Shawn Steward Avatar asked Jan 20 '10 18:01

Shawn Steward


People also ask

What is button in VB net?

Advertisements. The Button control represents a standard Windows button. It is generally used to generate a Click event by providing a handler for the Click event. Let's create a label by dragging a Button control from the Toolbox ad dropping it on the form.


1 Answers

I ran into a similar problem in VB.NET 2008.

When I set the background color of a textbox to something other than the default at design time, then when I disabled that textbox at runtime, it did not get that 'disabled' look; the background color remained unchanged. To get around this, I had to override the OnEnabledChanged method and manually set the background to what I needed.

This is a little different than the problem you have, but I think that overriding the OnEnabledChanged method might help you out.

like image 194
Stewbob Avatar answered Sep 30 '22 03:09

Stewbob