|
ize = g.MeasureString(str2Render, fontCounter); int nWidth = (int)stringSize.Width; int nHeight = (int)stringSize.Height; g.Dispose(); newBitmap.Dispose(); newBitmap = new Bitmap(nWidth,nHeight,PixelFormat.Format32bppARGB); g = Graphics.FromImage(newBitmap); g.FillRectangle(new SolidBrush(clrBackground), new Rectangle(0,0,nWidth,nHeight)); g.DrawString(str2Render, fontCounter, new SolidBrush(clrFont), 0, 0); MemoryStream tempStream = new MemoryStream(); newBitmap.Save(tempStream,ImageFormat.GIF); Response.ClearContent(); Response.ContentType = "image/GIF"; Response.BinaryWrite(tempStream.ToArray()); Response.End(); } catch (Exception e) { Response.Write(e.ToString()); } finally { if (null != g) g.Dispose(); if (null != newBitmap) newBitmap.Dispose(); } %>
作者:豆腐
上一页 [1] [2]
|