用vb怎么制作验证码
- 提问者网友:溺爱和你
- 2021-05-01 00:27
- 五星知识达人网友:从此江山别
- 2021-05-01 01:45
- 1楼网友:三千妖杀
- 2021-05-01 07:55
在窗体上添加一个PictureBox,代码:
Private Sub Picture1_Click() Dim YZM As String Randomize Picture1.Cls Picture1.FontSize = 15 Picture1.FontBold = True YZM = Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) Picture1.Print YZM '验证码 Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) '产生干扰 Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) End Sub
- 2楼网友:孤独入客枕
- 2021-05-01 07:04
那以上的代码要怎么来配合按健和TEXT呢,代码谁也出一下呢,要不这个不成了摆设
- 3楼网友:摆渡翁
- 2021-05-01 06:03
Private Sub Picture1_Click() Dim YZM As String Randomize Picture1.Cls Picture1.FontSize = 15 Picture1.FontBold = True YZM = Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) Picture1.Print YZM '验证码 Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) '产生干扰 Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) End Sub
这个方法还可以再根据需要加上点其它的功能。例如画线的顔色。每个字体的顔色等等
- 4楼网友:十年萤火照君眠
- 2021-05-01 04:39
一种最简单的方法.就是用0-9,A-Z,a-z生成随机码到lab控件里.再去验证.这种方法适合于新手...
- 5楼网友:舍身薄凉客
- 2021-05-01 03:03
在窗体上添加一个PictureBox,代码:
Private Sub Picture1_Click() Dim YZM As String Randomize Picture1.Cls Picture1.FontSize = 15 Picture1.FontBold = True YZM = Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) Picture1.Print YZM '验证码 Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) '产生干扰 Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) Picture1.Line (Int(Rnd * 500), Int(Rnd * 500))-(Int(Rnd * 500), Int(Rnd * 500)) End Sub