asp+ 制作图形

2016-01-29 14:01 8 1 收藏

asp+ 制作图形,asp+ 制作图形

【 tulaoshi.com - ASP.NET 】

/*
豆腐制作 都是精品
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
{
}

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com)

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();
}
%

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com)

作者:豆腐

来源:http://www.tulaoshi.com/n/20160129/1492271.html

延伸阅读
标签: Delphi
要建立一个自绘的ComboBox组件,我们先要把它的Style属性设为cs_OwnerDrawFixed或者cs_OwnerDrawVariable,如果在ComboBox组件中的所有元素都是相等高度的,例如字符或图标,那么就使用cs_OwnerDrawFixed;如果在ComboBox组件中的各个元素不是相等高度的,例如不同大小的位图,那么就使用 cs_OwnerDrawVariable属性。ComboBox组件会接收...
最初的考虑(一) 作 者 : 雨晨 它包括运行平台的配置,pagelet的建立,新的ADO+的使用,如何使用新的DataSet进行数据访问,HTML表格到DataList的转变,以及其他多种新的服务器端控件的使用技巧……还等什么?现在就来感受一下ASP+的全新魅力吧!) 自从微软在2000年7月的专业开发人员会议上宣布了ASP+以来, 一个相同的问题一直...
标签: ASP
       · 赵于·    ASP+是ASP的下一代版本,然而ASP+又并非从ASP3.0自然演化而来,在许多方面,ASP+与ASP有着本质的不同。ASP+完全基于模块与组件,具有更好的可扩展性与可定制性,数据处理方面更是引入了许多激动人心的新技术,正是这些具有革新意义的新特性,让ASP+远远超越了ASP,同时也...
标签: ASP
       花君      下面是用ASP+来纺写的上载例子!!在ASP中我们就才上载有许多组件:      <html>      <script language="VB" runat=server>   'VB代码   Sub UploadBtn_Click(Sender as Object, E as EventArg...
微软的MicroSoft.NET 战略将把计算带到完全的WEB 时代,而实际上 SUN 公司很早就为Internet 时代准备了Java, java 获得了业界的广泛支持,现在许多Web 应用采用java servlet 技术。本文将对MicroSoft.NET 中的ASP+ 与 JAVA 做一个比较,以获得对于WEB 计算的一个全面的了解一 、先介绍一下ASP+ 作 者 : 联想事业部 李建奇 ASP+ 是Micro...

经验教程

803

收藏

57
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部