最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
在网页中动态的生成一个gif图片
时间:2022-07-02 12:06:25 编辑:袖梨 来源:一聚教程网
大家知道股票网站的K线图是动态生成的定时刷新PHP 就有动态生成图片的功能
那么怎样用在网页中动态的生成一个图片呢?
下面我要举的例子是动态的生成一个图片显示当前时间
namespace Wmj
{
using System;
using System.Drawing;
using System.Web.UI;
public class MyTempImage : Page
{
public string CreateImage()
{
string str=DateTime.Now.ToString();
Bitmap image=new Bitmap(200,30);
Graphics g=Graphics.FromImage(image);
string thefullname=Server.MapPath("/")+"nowtime.gif";
g.Clear(Color.White);
g.DrawString(str,new Font("Courier New", 10),new SolidBrush(Color.Red),20,5);
//Graphics 类还有很多绘图方法可以绘制 直线、曲线、圆等等
image.Save(thefullname,System.Drawing.Imaging.ImageFormat.Gif);
return "/nowtime.gif";
}
}
}
///////////////////////////////////////////
那么怎样用在网页中动态的生成一个图片呢?
下面我要举的例子是动态的生成一个图片显示当前时间
namespace Wmj
{
using System;
using System.Drawing;
using System.Web.UI;
public class MyTempImage : Page
{
public string CreateImage()
{
string str=DateTime.Now.ToString();
Bitmap image=new Bitmap(200,30);
Graphics g=Graphics.FromImage(image);
string thefullname=Server.MapPath("/")+"nowtime.gif";
g.Clear(Color.White);
g.DrawString(str,new Font("Courier New", 10),new SolidBrush(Color.Red),20,5);
//Graphics 类还有很多绘图方法可以绘制 直线、曲线、圆等等
image.Save(thefullname,System.Drawing.Imaging.ImageFormat.Gif);
return "/nowtime.gif";
}
}
}
///////////////////////////////////////////
相关文章
- dota2不败时空领主动能宝石效果介绍 12-06
- 星球重启全食材采集攻略 食材坐标位置汇总 12-06
- 绝地求生小红鞋免费领取地址分享 12-06
- 致命公司传送器有什么用 传送器作用介绍 12-06
- dota2骑士之倚有什么用 骑士之倚效果介绍 12-06
- 致命公司雷达增强器怎么用 雷达发射器使用教学 12-06