首 页 编程技术 网页设计 软件频道 系统维护 网络安全 范文大全 站长专区
首 页 编程技术 网页设计 软件频道 系统维护 网络安全 范文大全 站长专区
设为首页
加入收藏
联系我们
首 页 | ASP技术 | PHP技术 | NET技术 | JSP技术 | AJAX | C++ | JavaScript | HTML | | 布局配色 | MSSQL | MySQL | Access
DreamWeaver | FrontPage | Flash | PhotoShop | Firework | CorelDraw | 操作系统 | 办公软件 | 网络营销 | 搜索引擎 | 站长专区 | 服务器 | 范文大全 | 安全
asp+ 制作图形
发布日期:[08-03-20 00:26:43] 点击次数:[]
这个程序经过修改 现在作计数器的话 只能做黑白的 计数器,谁有办法 能够做出 复杂的 图形计数器?
<% @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();
}
%>

上一篇:
下一篇:

热点文章

· 鼠年知运 2008年编程语言运势抢先
· Windows Server 2008新功能影响应
· 程序员的处世哲学:好酒不怕巷子
· 使用AJAX技术构建更优秀的Web应用
· 你的网站为什么粘不住流量? 
· SCA,软件开发的3G时代
· 浅谈网上教学的实践与探索
· 论IP电话在我国的发展
· 2008年最热门的七大IT软件技能
· 教你四招--轻松让你成为Excel函数
· WIN2000 SERVER安全配置服务器手
· WIN2000 SERVER安全配置服务器手
· Fireworks 8 混合模式详解2
· 浅谈网上教学的实践与探索
· 完整的Windows 2000服务配置

搜索引擎

网站留言 | 友情连接 | 广告服务 | 版权申明 | 合作伙伴 | 法律声明 | 人员招聘 | 网站简介 | 联系我们 | About Us
站内所有资源均收集于互联网,其版权属原作者所有。 E吧-中国IT门户欢迎你的光临!
赣ICP备07501208号