开发者

C# - Disable buttons with image

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 !

C# - Disable buttons with image

As you can see in the picture, the first button uses BackgroundImage , the second o开发者_StackOverflow社区ne 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 !


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜