.NET Graphics on Windows 7: White corners around images?
I've been working on some custom graphics controls, and I found this weird problem with windows 7 rendering my button controls. I've used Photoshop to delete the pixels in the background all around the button image I'm using, then saved it as a GIF, and imported it into VS to use as the background image of my button. When windows XP renders it, it is fine, but when windows 7 renders it, all 4 corners have an odd white border around them.
You can barely see them in thi开发者_如何学JAVAs pic, but they are much more apparent when looking at them on the client PC's.
Is there something wrong with the way I am transfering the image? should I not use a gif? is there something wrong with the way I am displaying it on the button? What can I do about it?
GIF was a bad choice, it can only render images with 256 colors. You need all the colors you can get to make the anti-aliasing work properly. Use PNG.
You will also need to make sure that the background color of the container is the same as the one you used in Photoshop, the anti-aliasing pixels will otherwise have the wrong colors. And you cannot stretch the image, that will also stretch the anti-aliasing pixels, ruining the effect.
精彩评论