string _FontName = Request["fontname"].ToString();
int _FontSize = Co***rt.ToInt16(Request["fontsize"]);
string _ShowName = Request["str"].ToString();
Bitmap objBitmap = null;
Graphics g = null ;
Font stringFont = new Font(_FontName, _FontSize, Fo***tyle.Bold );
StringFormat stringFormat = new StringFormat();
st***gFormat.FormatFlags = St***gFormatFlags.NoWrap;
try
{
objBitmap = new Bitmap(1,1);
g = Gr***ics.FromImage(objBitmap);
SizeF stringSize = g.***sureString(_ShowName, stringFont);
int nWidth = (int)st***gSize.Width;
int nHeight = (int)st***gSize.Height;
g.***pose();
ob***tmap.Dispose();
objBitmap = new Bitmap(nWidth,nHeight);
g = Gr***ics.FromImage(objBitmap);
g.***lRectangle(new SolidBrush(Co***.Yellow), new Rectangle(0,0,nWidth,nHeight));
g.***tRenderingHint = Te***enderingHint.AntiAlias;
g.***wString(_ShowName, stringFont, new SolidBrush(Co***.Black), new PointF(0, 0), stringFormat);
ob***tmap.Save(Re***nse.OutputStream, Im***Format.Gif);
}
catch (Exception ee)
{
Re***nse.Write(ee***String());
}
finally
{
if (null != g) g.***pose();
if (null != objBitmap) ob***tmap.Dispose();
Re***nse.End();
}
上一篇: ASP.NET提供文件下载函数