在页面上画图,整个页面除了图以外都无法显示了
我向做一个验证码是用Drawing画到页面
验证码能显示出来,但是除了验证码以外整个页面都没法显示了 请问这是怎么会事?
代码是:
Random rm = new Random();
char[] validateCharArry = {
Convert.ToChar(rm.Next(48, 90)),
Convert.ToChar(rm.Next(48, 90)),
Convert.ToChar(rm.Next(48, 90)),
Convert.ToChar(rm.Next(48, 90))};
string varlidateStr = new string(validateCharArry);
System.Drawing.Image backImage = System.Drawing.Image.FromFile(MapPath( "/SecondOnlineShop/Image/Face/ValidateBack.gif "));
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(backImage, backImage.Width, backImage.Height);
//Bitmap bm = new Bitmap(50, 50);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bm);
//gr.Clear(Color.Wheat);
System.Drawing.SolidBrush sb = new System.Drawing.SolidBrush(System.Drawing.Color.DeepPink);
System.Drawing.Font f = new System.Drawing.Font( "宋体 ", 15);
gr.DrawString(varlidateStr, f, sb, 3, 5);
bm.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
[解决办法]
要在另外一个页面用 <img src=xxx这个页面> 才行