zoukankan
html css js c++ java
产生随机图片,并返回图片内的文字
/**/
///
<summary>
///
产生随机图片,并返回图片内的文字
///
</summary>
///
<param name="img">
要显示图片的控件
</param>
///
<param name="path">
图片显示的文字
</param>
public
string
R_random(System.Web.UI.WebControls.Image img,
string
path)
{
string
tmp;
//
文字
Random rnd
=
new
Random();
tmp
=
rnd.Next().ToString().Substring(
0
,
4
);
Graphics g
=
null
;
Bitmap bmp
=
new
Bitmap(
50
,
100
);
g
=
Graphics.FromImage(bmp);
SizeF rec
=
g.MeasureString(tmp,
new
Font(
"
宋体
"
,
12
));
int
nwidth
=
(
int
)rec.Width;
int
nheight
=
(
int
)rec.Height;
g.Dispose();
bmp.Dispose();
bmp
=
new
Bitmap(nwidth,nheight);
g
=
Graphics.FromImage(bmp);
g.FillRectangle(
new
SolidBrush(Color.FromArgb(
90
,
126
,
220
)),
new
Rectangle(
0
,
0
,nwidth,nheight));
g.DrawString(tmp,
new
Font(
"
宋体
"
,
12
),
new
SolidBrush(Color.Yellow),
new
PointF(
0
,
0
));
string
fff
=
path
+
@"
tmp\validation.gif
"
;
bmp.Save(fff,System.Drawing.Imaging.ImageFormat.Gif);
img.ImageUrl
=
fff;
return
tmp;
查看全文
相关阅读:
Ubuntu安装adobe的Source Code Pro
Oracle实现主键自增的几种方式
Oracle主键自增
activity 根据流程实例ID删除流程实例、删除流程部署
解决报错:错误1130- Host xxx is not allowed to connect to this MariaDb server
Idea-每次修改JS文件都需要重启Idea才能生效解决方法
html中<a href> </a>的用法
Mysql8_数据库基础操作
java反射及Method的Invoke方法(转载)
oracle查询数据插入时间
原文地址:https://www.cnblogs.com/aipeli/p/251775.html
最新文章
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
xtrabackup: Redo Log Archiving is not set up
linux
Centos 8升级内核版本
Redis 5大数据结构
Oracle实现split功能,把字符串拆分成多行处理
通过springboot提供请求参数以及返回值为XML的服务
4.FFMPEG-AVFrame
3.AVPacket使用
2.AVFormatContext和AVInputFormat
热门文章
没有备案的网站,怎么才能被百度快速收录?
经典有声小说 100部 MP3版本(收藏)
全网最全17个各类小说TXT版包包 【收藏】
做seo必须懂的十条搜索引擎语法
4K视频,4K电视分别指什么?
全网最全最值得收藏的电子书免费收藏
全网经典制作的论文360多个模板统统免费收藏
职场提升必读的12本书[全PDF版] 收藏
WordPress分页插件:WP-PageNavi
HWIDGen v62.01 汉化版 win10激活工具一键永久激活免费版
Copyright © 2011-2022 走看看