源碼:
'delay
Private Sub Delay(ASecond As Integer)
Dim t
t = Timer
Do
DoEvents
Loop Until (Int(Timer - t) = ASecond)
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 10
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Text1_Change()
ans = Label1.Caption & Label2.Caption & Label3.Caption & Label4.Caption & Label5.Caption & Label6.Caption
If Text1.Text = ans Then
Label7.Caption = "√ 輸入正確"
Label7.ForeColor = &H8000&
Else
Label7.Caption = "╳ 輸入錯誤"
Label7.ForeColor = &HFF&
End If
End Sub
Private Sub Timer1_Timer()
Randomize '隨機產生
For i = 1 To 150
Label1.Caption = Int((9 * Rnd) + 1) '數字
Label1.FontSize = Int((40 - 15 + 1) * Rnd + 15) '大小
Label1.ForeColor = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd)) '顏色
Label2.Caption = Int((9 * Rnd) + 1) '類推...
Label2.FontSize = Int((40 - 15 + 1) * Rnd + 15)
Label2.ForeColor = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd))
Label3.Caption = Int((9 * Rnd) + 1)
Label3.FontSize = Int((40 - 15 + 1) * Rnd + 15)
Label3.ForeColor = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd))
Label4.Caption = Int((9 * Rnd) + 1)
Label4.FontSize = Int((40 - 15 + 1) * Rnd + 15)
Label4.ForeColor = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd))
Label5.Caption = Int((9 * Rnd) + 1)
Label5.FontSize = Int((40 - 15 + 1) * Rnd + 15)
Label5.ForeColor = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd))
Label6.Caption = Int((9 * Rnd) + 1)
Label6.FontSize = Int((40 - 15 + 1) * Rnd + 15)
Label6.ForeColor = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd))
Delay (0.5)
Next
Timer1.Enabled = False
End Sub
仿圖片認證碼.rar
(6.4 KB, 下載次數: 142)
|