using System.Drawing.Drawing2D; using System.IO; using System.Drawing.Imaging;Bitmap validateimage; Graphics g; validateimage = new Bitmap(80, 20,PixelFormat.Format24bppRgb); g = Graphics.FromImage(validateimage);
g.DrawString("abcdefy123456", new Font("黑体",12,FontStyle.Bold),new SolidBrush(Color.White),new PointF(4,1)); g.FillRectangle(new LinearGradientBrush(new Point(0,0), new Point(100,20), Color.FromArgb(0,0,0,0),Color.FromArgb(255,255,255,255)),0,0,80,20); g.Save(); MemoryStream ms=new MemoryStream(); validateimage.Save(ms,System.Drawing.Imaging.ImageFormat.Gif); e.Response.ClearContent(); e.Response.ContentType="image/gif"; e.Response.BinaryWrite(ms.ToArray());
using System.IO;
using System.Drawing.Imaging;Bitmap validateimage;
Graphics g;
validateimage = new Bitmap(80, 20,PixelFormat.Format24bppRgb);
g = Graphics.FromImage(validateimage);
g.DrawString("abcdefy123456", new Font("黑体",12,FontStyle.Bold),new SolidBrush(Color.White),new PointF(4,1));
g.FillRectangle(new LinearGradientBrush(new Point(0,0), new Point(100,20), Color.FromArgb(0,0,0,0),Color.FromArgb(255,255,255,255)),0,0,80,20);
g.Save();
MemoryStream ms=new MemoryStream();
validateimage.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);
e.Response.ClearContent();
e.Response.ContentType="image/gif";
e.Response.BinaryWrite(ms.ToArray());
如何把生成的图形赋值给页面上已经存在的image控件呢