System.Drawing.Image image = System.Drawing.Image.FromFile("G:\\zt_tg.jpg");
            using (Bitmap bmp = new Bitmap(image.Width, image.Height))
            {
                // 绘制验证码文本
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.DrawImage(image, 0, 0, image.Width, image.Height);
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    this.Response.ContentType = "image/png";
                    ms.WriteTo(this.Response.OutputStream);
                    ms.Close();
                }
            }
posted on 2012-07-12 14:24  万德源  阅读(204)  评论(0编辑  收藏  举报