频道直达 - 学院 - 下载 - 交易 - 截图 - 特效 - 字库 - 手册 - 排名-工具 - 繁體
设为首页
加入收藏
联系我们
建站搜索: 虚拟主机  域名注册   常用广告代码      用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发 -> Asp.Net -> 文章内容
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 通过google 赶快来赚..
· [图文] 头像-qq头像(..
· 要10G免费网络硬盘的..
· 注册码大全三
· 注册码大全十
· [图文] 梦幻背景图片..
· [图文] 卡通动物图片..
相关文章
· 短信诈骗出新花样 一句"..
· 马云发贴称招财进宝的收..
· Photoshop滤镜打造立体方..
· [国外]100m/1g/php/mysq..
· Mysql字段长度
· 8GB/网络储存空间/young..
· Macromedia Flex 标记语..
· 如何修改mysql_connecti..
· 读取Access数据库表名实..
· ASP漏洞分析和解决方法(..
asp+ 制作图形
作者:未知  来源:转载  发布时间:2005-7-20 10:04:46  发布人:acx

减小字体 增大字体

/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如转载 请保留版权信息
*/
这个程序经过修改 现在作计数器的话 只能做黑白的 计数器,谁有办法 能够做出 复杂的 图形计数器?
<% @Page Language="C#" %>
<% @Import Namespace="System.Drawing" %>
<% @Import Namespace="System.IO" %>
<% @Import Namespace="System.Drawing.Imaging" %>
<%
Response.Expires = 0;
Bitmap newBitmap = null;
Graphics g = null ;
string str2Render = Request.QueryString.Get("HitCount");
if (null == str2Render) str2Render = "12345";
string strFont = Request.QueryString.Get("HitFontName");
if (null == strFont) strFont = "楷体_GB2312";
int nFontSize = 12;
try
{
nFontSize = Request.QueryString.Get("HitFontSize").ToInt32();
}
catch
{
// do nothing, just ignore
}

string strBackgroundColorname = Request.QueryString.Get("HitBackgroundColor");
Color clrBackground = Color.White;
try
{
if (null != strBackgroundColorname)
clrBackground = ColorTranslator.FromHTML(strBackgroundColorname);
}
catch
{
}

string strFontColorName = Request.QueryString.Get("HitFontColor");
Color clrFont = Color.Black;
try
{
// Format in the URL: %23xxXXxx
if (null != strFontColorName)
clrFont = ColorTranslator.FromHTML(strFontColorName);
}
catch
{
}

try
{
Font fontCounter = new Font(strFont, nFontSize);
newBitmap = new Bitmap(1,1,PixelFormat.Format32bppARGB);
g = Graphics.FromImage(newBitmap);
SizeF stringSize = 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();
}
%>

作者:豆腐

[打 印]
[] [返回上一页] [收 藏]
下一篇文章:asp+发送Email完全手册
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
未经授权禁止转载、摘编、复制或建立镜像.如有违反,追究法律责任.
免责申明:中国建站之家(www.jz123.cn)上的所有提供下载的软件和资源
均来源于网络,为软件或程序作者提供和网友推荐收集整理而来,仅供学习
和研究使用。如有侵犯你的版权,请立即联系我们,本站将在3个工作日内删除。
粤ICP备05092265号