我爱Aspx >> Asp.Net >> 开发基于ASP.NET WebService的图片验证码服务System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(nBmpWidth,nBmpHeight);
// 1. 生成随机背景颜色
int nRed,nGreen,nBlue; // 背景的三元色
System.Random rd = new Random((int)System.DateTime.Now.Ticks);
nRed = rd.Next(255)%128+128;
nGreen = rd.Next(255)%128+128;
nBlue = rd.Next(255)%128+128;
// 2. 填充位图背景
System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(bmp);
graph.FillRectangle(new SolidBrush(System.Drawing.Color.FromArgb(nRed,nGreen,nBlue))
,0
,0
,nBmpWidth
,nBmpHeight);
// 3. 绘制干扰线条,采用比背景略深一些的颜色
int nLines = 3;
System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(nRed-17,nGreen-17,nBlue-17),2);
for(int a =0;a< nLines;a++)
{
int x1 = rd.Next() % nBmpWidth;
int y1 = rd.Next() % nBmpHeight;
int x2 = rd.Next() % nBmpWidth;
Ҷƪл˵?
开发ASP.NET Atlas服务器端Exten..[08-01]
在ASP.net中保存/取出图片入/从S..[08-01]
.net下访问Access数据库需要注意..[08-01]
IIS同一站点下aps.net 1.1与2.0 ..[08-01]
创建ASP.NET程序时候发生错误&qu..[08-01]
ASP.Net防止刷新自动触发事件的解..[08-01]
ASP.net:Literal控件用法[08-01]
ASP.NET 2.0的视图状态持久性机制[08-01]
开发ASP.NET Atlas服务器端Exten..[08-01]
asp.net中XML文件作为中间件进行..[08-01]
六步使用ICallbackEventHandler实..[08-01]
开发ASP.NET Atlas服务器端Exten..[08-01]
在ASP.net中保存/取出图片入/从S..[08-01]
调试javascript的好方法[08-01]
Windows版本Discuz!—EasyDiscuz..[08-01]
Photoshop修图技巧:巧为扫描图像..[08-01]
Photoshop显身手 灌篮高手人人当[08-01]
用Photoshop给照片制作艺术边缘[08-01]
在word中实现表格的行列转置[08-01]
多媒体视频文件修复完全攻略[08-01]