欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【ASP.net生成文字图片】,下面是详细的分享!
ASP.net生成文字图片
string_FontName=Request["fontname"].ToString();
int_FontSize=Convert.ToInt16(Request["fontsize"]);
string_ShowName=Request["str"].ToString();
BitmapobjBitmap=null;
Graphicsg=null;
FontstringFont=newFont(_FontName,_FontSize,FontStyle.Bold);
StringFormatstringFormat=newStringFormat();
stringFormat.FormatFlags=StringFormatFlags.NoWrap;
try
{
objBitmap=newBitmap(1,1);
g=Graphics.FromImage(objBitmap);
SizeFstringSize=g.MeasureString(_ShowName,stringFont);
intnWidth=(int)stringSize.Width;
intnHeight=(int)stringSize.Height;
g.Dispose();
objBitmap.Dispose();
objBitmap=newBitmap(nWidth,nHeight);
g=Graphics.FromImage(objBitmap);
g.FillRectangle(newSolidBrush(Color.Yellow),newRectangle(0,0,nWidth,nHeight));
g.TextRenderingHint=TextRenderingHint.AntiAlias;
g.DrawString(_ShowName,stringFont,newSolidBrush(Color.Black),newPointF(0,0),stringFormat);
objBitmap.Save(Response.OutputStream,ImageFormat.Gif);
}
catch(Exceptionee)
{
Response.Write(ee.ToString());
}
finally
{
if(null!=g)g.Dispose();
if(null!=objBitmap)objBitmap.Dispose();
Response.End();
}
以上所分享的是关于ASP.net生成文字图片,下面是编辑为你推荐的有价值的用户互动:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
