现在的位置: 首页 > 综合 > 正文

显示路径下图片

2012年08月21日 ⁄ 综合 ⁄ 共 628字 ⁄ 字号 评论关闭

   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();
                }
            }

抱歉!评论已关闭.