-

- 加为好友
- 发送私信
- 在线聊天
|
| 发表于:2008-05-07 15:37:42 楼主 |
专家啊,救命啊! private void DesignImage(string DesFilePath,int DesR,int DesWidth,int DesHeight) { System.Drawing.Image DesImage = System.Drawing.Image.FromFile(DesFilePath); if(DesR==1) { DesImage.RotateFlip(RotateFlipType.Rotate90FlipY); //90度旋转 } else if (DesR == 2) { DesImage.RotateFlip(RotateFlipType.RotateNoneFlipY); //180度旋转 } else if (DesR == 3) { DesImage.RotateFlip(RotateFlipType.Rotate270FlipY);//360度旋转 } int x = 0; int y = 0; int w = DesImage.Width; int h = DesImage.Height; //目标位图 Bitmap dsImage = new Bitmap(DesWidth, DesHeight); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage); //设置高质量插值法 g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量,低速度呈现平滑程度 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //g.Clear(System.Drawing.Color.Transparent); Color color = Color.FromArgb(0, Color.Transparent); //背景透明 g.FillRectangle(new SolidBrush(color), new Rectangle(0, 0, DesWidth, DesHeight)); g.DrawImage(DesImage, new System.Drawing.Rectangle(0, 0, DesWidth, DesHeight), new System.Drawing.Rectangle(x, y, w, h), System.Drawing.GraphicsUnit.Pixel); dsImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif); g.Dispose(); } 以上的代码是我实现透明图片输出的函数内容,可输出的图片的背景不是透明色,而是黑色,调试了很多次,都无法解决,特开此贴,请专家救急啊! |
|
|
|
100
修改
删除
举报
引用
回复
| |