當前位置:編程學習大全網 - 網站源碼 - 誰會用vb6.0做壹個帶有驗證碼識別的登陸界面

誰會用vb6.0做壹個帶有驗證碼識別的登陸界面

新建工程,添加壹個picturebox,壹個textbox,兩個command button

Dim vCode As String

Private Sub Command1_Click()

drawvc

End Sub

Private Sub drawvc() '顯示校驗碼

Dim i, vc, px, py As Long

Dim r, g, b As Byte

Randomize '初始化隨機種子

'生成隨機校驗碼

vc = CLng(8999 * Rnd + 1000)

vCode = vc

'顯示校驗碼

Picture1.Cls

Picture1.Print vc

'添加噪點(防止自動圖像識別)

For i = 0 To 2000 '畫2000個噪點

'畫點隨機位置

px = CLng(Picture1.Width * Rnd)

py = CLng(Picture1.Height * Rnd)

'畫點隨機顏色

r = CByte(255 * Rnd)

g = CByte(255 * Rnd)

b = CByte(255 * Rnd)

Picture1.Line (px, py)-(px + 1, py + 1), RGB(r, g, b)

Next

End Sub

Private Sub Command2_Click()

If Text1.Text = vCode Then

MsgBox ("正確")

Else

MsgBox ("錯誤")

drawvc

End If

End Sub

Private Sub Form_Load()

Picture1.FontSize = 12

Picture1.FontBold = True

Picture1.AutoRedraw = True

drawvc

End Sub

妳也可以自己畫點其他的東西,增加識別難度

  • 上一篇:4399遊戲盒每天簽到,壹個月可以得到多少盒幣。
  • 下一篇:伊利追溯碼系統
  • copyright 2024編程學習大全網