Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Command1_Click()
- '第一題,加密後放text2
- Text2 = ""
- For i = 1 To Len(Text1)
- Text2 = Text2 & Chr(Asc(Mid(Text1, i, 1)) + Text4)
- Next
- End Sub
- Private Sub Command2_Click()
- '第二題,解密後放text3
- Text3 = ""
- For i = 1 To Len(Text2)
- Text3 = Text3 & Chr(Asc(Mid(Text2, i, 1)) - Text4)
- Next
- End Sub
- Private Sub Command3_Click()
- '第三題,解密後放text6
- n = -10
- Text6 = ""
- For i = 1 To Len(Text5)
- Text6 = Text6 & Chr(Asc(Mid(Text5, i, 1)) + n)
- Next
- End Sub
- Private Sub Command4_Click()
- '第四題,轉盤解碼
- Timer1.Interval = 800
- Label2 = 26
- End Sub
- Private Sub Timer1_Timer()
- Me.Cls '清除form1上面的所有作畫
- 'cos(n),n的值由0-2PI
- '***********下面的cos(0) sin(0)請參考講義改寫她才會轉動*************
- x = (Image1.Left + Image1.Width / 2) + 2800 * Cos(Label2 * 2 / 53 * 3.14)
- y = (Image1.Top + Image1.Height / 2) + 2800 * Sin(Label2 * 2 / 53 * 3.14)
- '*******************************************************************
- '畫線,從中心點到上述算出的角度座標
- Line ((Image1.Left + Image1.Width / 2), (Image1.Top + Image1.Height / 2))-(x, y), vbRed
- '*********第四題,解碼並用instr檢查是否正確
- Text6 = ""
- For i = 1 To Len(Text5)
- Text6 = Text6 & Chr(Asc(Mid(Text5, i, 1)) - Label2)
- Next
- If InStr(Text6, Text7) Then
- MsgBox Label2
- Timer1.Interval = 0
- Else
- Label2 = Label2 - 1
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement