|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全asp+|图形001<%@PageLanguage="C#"%>002<%
@ImportNamespace="System.Drawing"%>003<%@ImportNamespace="System.IO"%>004<%@ImportNamespace="System.Drawing.Imaging"%
>005<%006Response.Expires=0;007BitmapnewBitmap=null;008Graphicsg=null;009010stringstr2Render=
Request.QueryString.Get("HitCount");011if(null==str2Render)str2Render="nocount
specified";012stringstrFont=Request.QueryString.Get
("HitFontName");013if(null==
strFont)strFont="LucidaSansUnicode";014015intnFontSize=
12;016try017{018nFontSize=Request.QueryString.Get("HitFontSize").ToInt32();019}020catch021{022//donothing,justignore023}024025stringstrBackgroundColorname=Request.QueryString.Get("HitBackgroundColor");026Color
clrBackground=Color.White;027try028{029//FormatintheURL:%23xxXXxx030
if(null!=strBackgroundColorname)031
clrBackground=ColorTranslator.FromHTML(strBackgroundColorname);032}033catch034{035}036037stringstrFontColorName=
Request.QueryString.Get("HitFontColor");038ColorclrFont=Color.Black;039try040{041//FormatintheURL:%
23xxXXxx042if(null!=strFontColorName)043clrFont=ColorTranslator.FromHTML
(strFontColorName);044}045catch046{047}048049try050{051FontfontCounter=newFont(strFont,nFontSize);052053//calculatesizeofthestring.054
newBitmap=newBitmap(1,1,PixelFormat.Format32bppARGB);055g=Graphics.FromImage(newBitmap);056SizeFstringSize=g.MeasureString(str2Render,
fontCounter);057intnWidth=(int)
stringSize.Width;058intnHeight=(int)
stringSize.Height;059g.Dispose();060newBitmap.Dispose();061062newBitmap=
newBitmap(nWidth,nHeight,PixelFormat.Format32bppARGB);063g
=Graphics.FromImage(newBitmap);064g.FillRectangle(new
SolidBrush(clrBackground),newRectangle(0,0,nWidth,nHeight));065066g.DrawString
(str2Render,fontCounter,newSolidBrush(clrFont),0,0);067
068MemoryStreamtempStream=newMemoryStream();069newBitmap.Save(tempStream,ImageFormat.PNG);070071
Response.ClearContent();072Response.ContentType="image/png";073Response.BinaryWrite
(tempStream.ToArray());074
Response.End();075//newBitmap.Save
(Response.OutputStream,ImageFormat.PNG);076//newBitmap.Save("o:TestAppsTestServer est.png",ImageFormat.PNG);077}078catch(Exceptione)
079{080
Response.Write(e.ToString());081}082finally083{084if(null!=g)g.Dispose();085if(null!=newBitmap)newBitmap.Dispose();086}087%>
</p>asp,你就只能等着微软给你解决,它不乐意你就只好悲催。而且asp跑在windows服务器上,windows服务器跟linux比起来简直弱爆了! |
|