Visual Basic Windows窗体 - 帮助加载与数值

时间:2016-04-25 19:21:10

标签: vb.net visual-studio

您好我正在尝试制作德州扑克风格的游戏,并且即时通讯中我填充了数字1-52随机分类的数组。我首先从数组的第一个索引中提取值,并将相应的卡片图片设置为图片框值。我已经在我的资源中保存了52张.png文件。这些图片的名称也保存为1.png,2.png,3.png ......等等,具体取决于套装和价值。

我将这些值分类为1-13个黑桃(2-ace),14-26颗心,27-39颗钻石,40-52个球杆。

我也刚刚看到我应该使用全球计数器来跟踪甲板位置。

Public Class Form1

    Dim Deal As MsgBoxResult
    Dim CardDeck As New Random
    Dim Counter As Integer = 1
    Dim CardCount(52) As Integer

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnStart.Click

        Deal = MessageBox.Show("Would you like to start a Game?", "Texas Holde'em", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        ShuffleDeck()
        CalculateFirst3Cards()

    End Sub

    Private Sub ShuffleDeck()

        If Deal = MsgBoxResult.Yes Then
            For num As Integer = 1 To CardCount.Length - 1
                Dim DeckValue As Integer = CardDeck.Next(1, 52)
                CardCount(Counter) = DeckValue
                Counter += 1
            Next
        End If

    End Sub

    Private Sub CalculateFirst3Cards()
        Dim counter As Integer = 1
        For num As Integer = 1 To 3
            Dim hold As Integer = CardCount(counter)
            Dim hold1 As String = Convert.ToString(hold)
            River1.Image = My.Resources.

            counter += 1
        Next

    End Sub

End Class

0 个答案:

没有答案