GDI+ WEB程序中画图 gif加水印http://topic.csdn.net/u/20091101/00/ddcd9f9e-ba9c-4331-9be3-4b462f261fac.html 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Bitmap bmp; string pathmap = "E:\\temp\\test1.bmp";//这是一张透明的图片 System.Drawing.Image img = System.Drawing.Image.FromFile(pathmap); if (IsPixelFormatIndexed(img.PixelFormat)) { bmp = new Bitmap(img.Width, img.Height, PixelFormat.Format32bppArgb); } else { bmp = new Bitmap(pathmap); } GraphicsPath path = new GraphicsPath(); Graphics graphics = Graphics.FromImage(bmp); path.AddEllipse(0, 0, 300, 300); PathGradientBrush pthGrBrush = new PathGradientBrush(path); ColorBlend colorBlend = new ColorBlend(); colorBlend.Colors = new Color[] { Color.FromArgb(128, 255, 0, 0), Color.FromArgb(128, 255, 255, 0), Color.FromArgb(128, 0, 255, 0) }; colorBlend.Positions = new Single[] { 0.0f, 0.4f, 1.0f }; pthGrBrush.InterpolationColors = colorBlend; graphics.CompositingQuality = CompositingQuality.GammaCorrected; graphics.FillEllipse(pthGrBrush, 0, 0, 300, 300); bmp.Save("E:\\temp\\button.gif", System.Drawing.Imaging.ImageFormat.Gif);//生成的图片除了上面有我画的圆外,原先透明的图片已变成黑色,这是为什么?? graphics.Dispose(); bmp.Dispose(); 上面是我测试的代码,圆是画出来了,但是背景透明的部分全部是黑色 不懂,我只是知道GIF需要使用一种任意颜色标示为透明色 学习。我知道的是,BMP格式没有Aphla值的,怎么会是透明的图片呢? 应该是GIF格式,我放代码的时候没有改过来。做了一张GIF的透明图片 求教公司要开发财务管理系统,我选c#还是Java? 应用程序调用存储过程 C#如何获取用户当前电脑屏幕大小?比如1024*768,如何获得? 关于只读属性的问题 请问Session是保存在哪的 关于网络游戏中的问题? asp.net问题~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C#求教 初学者--初级问题 c#文件夹 跪求 .NET CS+BS的解决方案 有關編寫組件問題(急)
string pathmap = "E:\\temp\\test1.bmp";//这是一张透明的图片
System.Drawing.Image img = System.Drawing.Image.FromFile(pathmap);
if (IsPixelFormatIndexed(img.PixelFormat))
{
bmp = new Bitmap(img.Width, img.Height, PixelFormat.Format32bppArgb);
}
else
{
bmp = new Bitmap(pathmap);
}
GraphicsPath path = new GraphicsPath();
Graphics graphics = Graphics.FromImage(bmp);
path.AddEllipse(0, 0, 300, 300);
PathGradientBrush pthGrBrush = new PathGradientBrush(path);
ColorBlend colorBlend = new ColorBlend();
colorBlend.Colors = new Color[] { Color.FromArgb(128, 255, 0, 0), Color.FromArgb(128, 255, 255, 0), Color.FromArgb(128, 0, 255, 0) };
colorBlend.Positions = new Single[] { 0.0f, 0.4f, 1.0f };
pthGrBrush.InterpolationColors = colorBlend;
graphics.CompositingQuality = CompositingQuality.GammaCorrected;
graphics.FillEllipse(pthGrBrush, 0, 0, 300, 300);
bmp.Save("E:\\temp\\button.gif", System.Drawing.Imaging.ImageFormat.Gif);//生成的图片除了上面有我画的圆外,原先透明的图片已变成黑色,这是为什么??
graphics.Dispose();
bmp.Dispose(); 上面是我测试的代码,圆是画出来了,但是背景透明的部分全部是黑色
学习。我知道的是,BMP格式没有Aphla值的,怎么会是透明的图片呢?