怎么用vb制作扑克牌

 我来答
百度网友cbb594f
推荐于2016-09-02 · 超过25用户采纳过TA的回答
知道答主
回答量:52
采纳率:0%
帮助的人:63.5万
展开全部
  Dim XipaiCishu As Integer

  Private Type Pai
  huase As String
  shuzi As String
  End Type

  Dim Puke(53) As Pai

  Private Sub Command1_Click()
  Dim TempA(25) As Pai
  Dim TempB(25) As Pai
  Dim i As Integer

  If XipaiCishu = 0 Then
  Form1.Print "扑克原状为:"
  For i = 0 To 53
  Form1.Print Tab((i Mod 13) * 10); Puke(i).huase & Puke(i).shuzi;
  If i Mod 13 = 12 Then Form1.Print
  Next i
  Form1.Print
  Else
  For i = 0 To 25
  TempA(i) = Puke(i)
  TempB(i) = Puke(i + 26)
  Next i
  For i = 0 To 25
  Puke(i * 2) = TempA(i)
  Puke(i * 2 + 1) = TempB(i)
  Next i

  Form1.Cls
  Form1.Print "第" & XipaiCishu & "次洗牌:"

  ' 洗牌前
  Form1.Print "左手:"
  For i = 0 To 25
  Form1.Print Tab((i Mod 13) * 10); TempA(i).huase; TempA(i).shuzi;
  If i Mod 13 = 12 Then Form1.Print
  Next i
  Form1.Print "右手:"
  For i = 0 To 25
  Form1.Print Tab((i Mod 13) * 10); TempB(i).huase; TempB(i).shuzi;
  If i Mod 13 = 12 Then Form1.Print
  Next i
  Form1.Print

  For i = 0 To 53
  Form1.Print Tab((i Mod 13) * 10); Puke(i).huase & Puke(i).shuzi;
  If i Mod 13 = 12 Then Form1.Print
  Next i
  Form1.Print
  End If

  XipaiCishu = XipaiCishu + 1
  End Sub

  Private Sub Form_Initialize()
  Dim i As Integer
  Dim j As Integer
  ' Dim Shuzi0 As String

  For i = 0 To 3
  For j = 0 To 12
  Select Case i
  Case 0
  Puke(i * 13 + j).huase = "黑桃"
  Case 1
  Puke(i * 13 + j).huase = "红桃"
  Case 2
  Puke(i * 13 + j).huase = "梅花"
  Case 3
  Puke(i * 13 + j).huase = "方块"
  End Select
  If j = 0 Then
  Puke(i * 13 + j).shuzi = "A"
  ElseIf j < 10 Then
  Puke(i * 13 + j).shuzi = CStr(j + 1)
  ElseIf j = 10 Then
  Puke(i * 13 + j).shuzi = "J"
  ElseIf j = 11 Then
  Puke(i * 13 + j).shuzi = "Q"
  ElseIf j = 12 Then
  Puke(i * 13 + j).shuzi = "K"
  End If
  Next j
  Next i
  Puke(52).huase = "彩色"
  Puke(52).shuzi = "王"
  Puke(53).huase = "黑白"
  Puke(53).shuzi = "王"

  XipaiCishu = 0
  End Sub

  只在窗体上加一个按钮就行了,还有要吧窗体啦的足够大。。。

参考资料: qq群里找的

本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式