views:

38

answers:

1

Hey all,

I'm using C# and WinForms.

When using a button with a BackgroundImage property, when I enable/disable the button, the image doesn't get gray... Result : The user is unable to tell if the button is enabled or disabled without trying to click it.

When using a button with a Image property, the image's behavior is correct but the image is not centered in the button !

alt text

As you can see in the picture, the first button uses BackgroundImage , the second one uses Image property but the minus sign is not centered properly... How can I manage this enable/disable state with a proper image's behavior ?

Thanks in advance !

+1  A: 

I was doing the same thing some time ago and everything worked out by just using the Image property. You could try to set ImageAlign:

button.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;

Maybe increase the dimensions of the button to see if that changes anything (maybe the image is just too big for the disabled button. All I can tell you is that it should work perfectly using the Image property.

testalino
Actually, I did that but I didn't try to change my button's size, it looks like it was my issue... Thank you very much !
Andy M