我需要在.NETCF中创建一个具有透明背景的图像,我使用洋红色作为我希望透明的背景。我试图做到这一点的方式是重写onPaint()。但我不能让背景透明?下面是我有:在紧凑框架中的透明度
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);
}
但是当我尝试,包括我的形象完全不绘制ImageAttributes?
在简单情况下,为什么不使用this.pnlMyPanel.BackColor = this.BackColor? – hellboy 2013-10-14 07:37:13