各位大大好,我现在在使用C#编写WINCE6.0下的透明背景图片上产生问题,我采用了ImageAttributes的类,代码如下:
//自绘
protected override void OnPaint(PaintEventArgs e)
{
if (BmpPicture != null)
{
ImageAttributes ImgAttr = new ImageAttributes();
ImgAttr.SetColorKey(BmpPicture.GetPixel(0x00, 0x00), BmpPicture.GetPixel(0x00, 0x00));
e.Graphics.DrawImage(BmpPicture, this.ClientRectangle, 0x00, 0x00, this.ClientRectangle.Width, this.ClientRectangle.Height, GraphicsUnit.Pixel, ImgAttr);
ImgAttr = null;
}
}
但是奇怪的是,图片并没有显示出透明,而是一个灰色的值,并不是窗口的背景色,但是说她不透明,却又是透明的,因为它完全透明到下面一个窗口的文字都显示出来了,我的这个图片是绘制在一个窗口上的,而这个窗口是下面一个窗口弹出来的,所以这个窗口是遮住下面这个窗口的,但是透明背景图片的地方,连下面的文字都看到了,这不是我想要的结果,请各位大大帮忙下。图片如下: