asp+ 制作图形

菱川夏嫡

菱川夏嫡

2016-01-29 14:01

asp+ 制作图形,asp+ 制作图形
/*
豆腐制作 都是精品
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
}

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

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
{
}

(本文来源于图老师网站,更多请访问https://m.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();
}
%

作者:豆腐

展开更多 50%)
分享

猜你喜欢

asp+ 制作图形

电脑网络
asp+ 制作图形

ASP+配置 — ASP+配置概念(二)

ASP
ASP+配置 — ASP+配置概念(二)

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

ASP+配置 — ASP+配置概念(一)

ASP
ASP+配置 — ASP+配置概念(一)

ASP+配置 — ASP+配置概念(三)

ASP
ASP+配置 — ASP+配置概念(三)

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

使用AspImage制作图形(二)

ASP
使用AspImage制作图形(二)

使用AspImage制作图形(一)

ASP
使用AspImage制作图形(一)

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

《放开那三国》比武攻略 两大技巧逆袭排名

《放开那三国》比武攻略 两大技巧逆袭排名

asp+中的session 的使用和原理() 不需要cookie也可以使用session

asp+中的session 的使用和原理() 不需要cookie也可以使用session
下拉加载更多内容 ↓