DrawImage problem in WM6
The code below is supposed to load an image from a GIF file, and draw it with
transparency. It works fine my WM5 devices, but on the WM6 device I'm
currently using, the image is drawn without transparency (i.e., with a purple
background).
protected override void OnPaint(PaintEventArgs e)
{
Bitmap bmp = new System.Drawing.Bitmap("\\Windows\\ques.gif");
if (bmp != null)
{
Color clr = bmp.GetPixel(0, 0);
ImageAttr attr = new ImageAttributes();
attr.SetColorKey(clr, clr);
e.Graphics.DrawImage(bmp, mRect,
0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attr);
}
}
I uploaded a copy of the GIF file, and set its transparency using PhotoShop.
If I use that version, it draws correctly, but that's not an option (my
production code actually gets the GIF file name from the registry).
It may be relevant that my code targets NETCF 1, which is not installed on
the WM6 device.
Any clues, or suggestions for a workaround, would be greatly appreciated.
--
David
Date:Wed, 1 Aug 2007 09:12:01 -0700
Author:
|
RE: DrawImage problem in WM6
>
> It may be relevant that my code targets NETCF 1, which is not installed on
> the WM6 device.
I built a test CF1 application with the above code, and it exhibited the
problem. I then upgraded it to CF2, and the problem went away.
Can anyone shed any light on why an application targeting CF1 would
misbehave in this way?
--
David
Date:Wed, 1 Aug 2007 10:50:02 -0700
Author:
|