您的位置:首页 > 编程语言 > C#

透明背景图像绘制(C#)

2011-03-26 09:57 375 查看
ImageAttributes vAttr = new ImageAttributes(); //vAttr是关键

//图像中与0,0那点相同的颜色要变成透明
vAttr.SetColorKey(((Bitmap)pictureBox1.Image).GetPixel(0, 0), ((Bitmap)pictureBox1.Image).GetPixel(0, 0));

//绘制透明的图像
e.Graphics.DrawImage(pictureBox1.Image , new Rectangle(10, 10, pictureBox1.Width, pictureBox1.Height) , 0, 0, pictureBox1.Image.Width, pictureBox1.Image.Height , GraphicsUnit.Pixel , vAttr);


完整的例子程序下载(Sample00002.rar)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: