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