VB 编写的 验证码功能 请求帮助 VB 编写 验证码 功能, 请问谁有没有相关资料,或者是什么原理 教教小弟! 谢谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1.窗体设计启动VB6并新建一个标准EXE工程,布置好控件并设置好名称。接着将两个图片框的AutoRedraw属性设置成True,txt_inp、cmd_browse的Enabled属性设置为False,txt_inp的Maxlength属性设置成10。然后单击“工程→部件”,勾选“Microsoft CommonDialog Control 6.0”。2.算法加密过程是程序的重点。在这里我们运用画线和画点函数来处理图片,在图片框上随机选两个点画直线,同时用随机函数确定它的颜色;再随机点一个点,同样用随机函数确定它的颜色。在这里我们还用随机取字体样式和背景色,不过要注意的是,背景和字体颜色的差别要搞大一些,由于每个RBG分量值越大颜色越深,因此我们用下面两条语句就可以增强颜色的对比度:pic_las.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)pic_las.BackColor = RGB(Rnd * 55, Rnd * 55, Rnd * 55)绘制图像的具体的代码如下:Sub AddPas() On Error GoTo Err1 pic_las.Print Space(10 - Len(Result)); Result Dim x, y, x1, x2, i As Integer '随机决定输出字体样式 pic_las.FontItalic = Int(Rnd * 2) pic_las.FontUnderline = Int(Rnd * 2) pic_las.ForeColor = RGB(Rnd * 155 + 100, Rnd * 155 + 100, Rnd * 155 + 100) '为验证码添加随机直线 For i = 1 To (Int(Rnd(1) * 8) + 1) x = Int(Rnd * pic_las.Width): y = Int(Rnd * pic_las.Height) x1 = Int(Rnd * pic_las.Width): Y1 = Int(Rnd * pic_las.Height) pic_las.Line (x, y)-(x1, Y1), RGB(Rnd * 255, Rnd * 255, Rnd * 255) Next i '为验证码随机添加圆点 For i = 1 To (Int(Rnd(1) * 200) + 100) pic_las.PSet (pic_las.Width * Rnd, pic_las.Height * Rnd), _ RGB(Rnd * 255, Rnd * 255, Rnd * 255) Next i '写入输出文件 If chk_file.value = 1 Then SavePicture pic_las.Image, txt_outfile.Text MsgBox "验证码已经保存在:" & txt_outfile.Text, vbInformation End If Exit SubErr1: '产生了错误 MsgBox Err.Number & ":" & Err.Description, vbExclamationEnd Sub摘自http://www.zhinfo.org/forum_view.asp?forum_id=28&view_id=2413 我有个例程,你可以参考一下,[email protected] installshield 中的注册表中某个值写作:<INSTALLDIR>\ 为什么结果无法被替换? vb+access急急急 关于绘制波形图的问题 请各位老师指教,就剩20分了 vb中opengl的小问题!! 如何在当前目录下建立文件? vb 能调用给其他的开发工具准备的dll 文件么 算法,不会? 知道Static控件的句柄 如何得到它包含超级链接地址 请问何处可下载 Visual Studio .NET ? 如何如何读取ini 文件啊~ 读取文本文件
pic_las.BackColor = RGB(Rnd * 55, Rnd * 55, Rnd * 55)
绘制图像的具体的代码如下:
Sub AddPas()
On Error GoTo Err1
pic_las.Print Space(10 - Len(Result)); Result
Dim x, y, x1, x2, i As Integer
'随机决定输出字体样式
pic_las.FontItalic = Int(Rnd * 2)
pic_las.FontUnderline = Int(Rnd * 2)
pic_las.ForeColor = RGB(Rnd * 155 + 100, Rnd * 155 + 100, Rnd * 155 + 100)
'为验证码添加随机直线
For i = 1 To (Int(Rnd(1) * 8) + 1)
x = Int(Rnd * pic_las.Width): y = Int(Rnd * pic_las.Height)
x1 = Int(Rnd * pic_las.Width): Y1 = Int(Rnd * pic_las.Height)
pic_las.Line (x, y)-(x1, Y1), RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next i
'为验证码随机添加圆点
For i = 1 To (Int(Rnd(1) * 200) + 100)
pic_las.PSet (pic_las.Width * Rnd, pic_las.Height * Rnd), _
RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next i
'写入输出文件
If chk_file.value = 1 Then
SavePicture pic_las.Image, txt_outfile.Text
MsgBox "验证码已经保存在:" & txt_outfile.Text, vbInformation
End If
Exit Sub
Err1: '产生了错误
MsgBox Err.Number & ":" & Err.Description, vbExclamation
End Sub
摘自
http://www.zhinfo.org/forum_view.asp?forum_id=28&view_id=2413
[email protected]