Option Explicit Dim Poker(53) As Long Private Sub Command1_Click() Dim i&, j&, n& Print "---初始化扑克---" For i = 65 To 68 ‘花色 For j = 1 To 13 ‘点数 Poker(n) = CLng("&h" & Chr(i) & Hex(j)) n = n + 1 Next j Next i ‘大小王 Poker(52) = &HF1: Poker(53) = &HF2 Call ShowPoker End Sub Private Sub Command2_Click() Dim i&, j&, r&, m& Print "---洗牌---" j = 53 For i = 0 To 53 r = Rnd * j m = Poker(j) Poker(j) = Poker(r) Poker(r) = m j = j - 1 Next i Call ShowPoker End Sub Private Sub ShowPoker() Dim i&, j& For i = 0 To 53 j = j + 1 If Poker(i) >= &HA1 And Poker(i) <= &HAD Then Me.ForeColor = &H80FF& ElseIf Poker(i) >= &HB1 And Poker(i) <= &HBD Then Me.ForeColor = &HC000& ElseIf Poker(i) >= &HC1 And Poker(i) <= &HCD Then Me.ForeColor = vbBlue ElseIf Poker(i) >= &HD1 And Poker(i) <= &HDD Then Me.ForeColor = &HFF00FF Else Me.ForeColor = &HFF& End If Print Hex(Poker(i)) & " "; If j Mod 13 = 0 Then Print Next i Print Print End Sub
时间: 2024-11-16 14:04:21