I need to create a image with a transparent background in .NETCF, I use magenta as the background I wish to make transparent. The way I have tried to do this is to override onPaint(). But I can't get the background transparent? Here's what I have:
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
ImageAttributes imageAttributs = new ImageAttributes();
imageAttributs.SetColorKey(Color.FromArgb(255, 0, 255),
Color.FromArgb(255, 0, 255));
g.DrawImage(cross, crossRect, 200, 10, cross.Width, cross.Height,
GraphicsUnit.Pixel, imageAttributs);
base.OnPaint(e);
}
But when I try to include the ImageAttributes my image is not drawn at all?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…