DrawImage problem in WM6

G

Guest

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.
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top