c#怎么显示五子棋棋子 - 爱问答

(爱问答)

c#怎么显示五子棋棋子

c#五子棋棋子怎么随着鼠标点击在窗口上显示 棋子是图片

谢谢大佬

c#怎么显示五子棋棋子

Public Class Form1

    Dim n, money As Integer, st As Boolean, a(1) As Image

    Private Sub init()

        Dim pbox As PictureBox

        P1.Image = a(0)

        P2.Image = a(0)

        P3.Image = a(0)

        n = Int(Rnd() * 3 + 1)

        pbox = Me.Controls("P" & n)

        pbox.Image = a(1)

    End Sub

    Private Sub init2(ByVal tf As Boolean)

        B1.Visible = tf

        B2.Visible = tf

        B3.Visible = tf

        Timer1.Enabled = Not tf

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        init2(False)

        Button1.Enabled = False

        NumericUpDown1.Enabled = False

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Static i As Integer

        i += 1

        If i > 10 Then

            init2(True)

            i = 0

            st = True

        End If

        init()

    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        a(0) = P1.Image '梅花10

        a(1) = P2.Image '红桃K

        Randomize()

        money = 1000

        init()

    End Sub

    Private Sub B1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click, B2.Click, B3.Click

        Dim pbox As PictureBox = sender

        pbox.Visible = False

        If st Then

            money += NumericUpDown1.Value * IIf(pbox.Tag = n, 1, -1)

            Label2.Text = "赌资:" & money

            NumericUpDown1.Maximum = money

            If money > 0 Then

                NumericUpDown1.Enabled = True

                Button1.Enabled = True

            Else

                Label4.Visible = True

            End If

            st = False

        End If

    End Sub

End Class

 

相关标签:五子棋

下一篇:求助!游戏直播的电脑硬盘买多大的好?有时候还会录制视频

上一篇:要创建可访问的超链接,“插入超链接”对话框的哪个字段应具有描述性文本?选一个

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?