I'm displaying a PNG with a transparent background that looks good in Windows 7, but then I run my app in XP Mode or remote desktop to a Windows XP machine and the PNG looks incorrect. I noticed that if I disable "Integration Mode" or run the app on XP without remote desktop, the image looks fine.
How do I get DrawImage to render the PNG correctly in XP Mode or remote desktop?
Image inside Windows 7
alt text http://www.freeimagehosting.net/uploads/957bb6ea8b.png
Image inside XP Mode or remote desktop
alt text http://www.freeimagehosting.net/uploads/08f1fbec46.png
Here's my code:
protected override void OnPaint(PaintEventArgs e)
{
Image image = Image.FromFile开发者_运维知识库("hello.png", false);
Bitmap bmp = new Bitmap(image);
Rectangle destRect = new Rectangle(0, 0, image.Width, image.Height);
e.Graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
base.OnPaint(e);
}
Remote Desktop by default runs with 16 bit color, which I believe is incompatible with alpha blending. You need to reconfigure the display for 32 bit mode, if that's possible.
精彩评论