views:

207

answers:

1

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?

+1  A: 

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.

Stewbob