在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例C#游戏开发 → winform老虎机

winform老虎机

C#游戏开发

下载此实例
  • 开发语言:C#
  • 实例大小:56.24M
  • 下载次数:14
  • 浏览次数:139
  • 发布时间:2017-01-10
  • 实例类别:C#游戏开发
  • 发 布 人:消防车V的吧
  • 所需积分:2
 相关标签: WinFrom

实例介绍

【实例简介】利用winform时间控件及随机数,循环即可简单完成,还加入了运行时老虎机的声音
【实例截图】
【核心代码】 int sj = 0;
        int man = 0;
        int zhong = 0;
        int kuai = 0;
        public int kahao = 0;
        private void Form11_Load(object sender, EventArgs e)
        {
            
            a4.BackColor = Color.Red;
            gengxin();
            
            
        }
        private void gengxin()
        {
            xx.Text = xx1.ToString();
            q.Text = qi1.ToString();
            xg.Text = xi.ToString();
            ld.Text = ld1.ToString();
            mg.Text = mg1.ToString();
            pg.Text = pg1.ToString();
            string sql = "select cishu from shuiguoji where kahao=" kahao " and zhuang=1";
            t = Convert.ToInt32(DBHelper.ExecuteScalar(sql));
            cishu.Text = t.ToString();

            wang.Text = wang1.ToString();
            ju.Text = ju1.ToString();
           
            if ((xx1 qi1 xi ld1 mg1 pg1 ju1 wang1) > 0 && timer1.Enabled == false)
            {
                button1.Enabled = true;

            }
            else
            {
                button1.Enabled = false;
            }
            if ((sz[0] sz[1] sz[2] sz[3] sz[4] sz[5] sz[6] sz[7]) <= int.Parse(jifen.Text) && (sz[0] sz[1] sz[2] sz[3] sz[4] sz[5] sz[6] sz[7]) > 0 && (button1.Enabled == false))
            {
                button3.Enabled = true;
            }
            else
            {
                button3.Enabled = false;
            }
            if (int.Parse(jifen.Text) == 0)
            {
                xing.Enabled = false;
                qi.Enabled = false;
                xigua.Enabled = false;
                mangguo.Enabled = false;
                lingdang.Enabled = false;
                pingguo.Enabled = false;
                gui.Enabled = false;
                juzi.Enabled = false;
            }
            else
            {
                xing.Enabled = true;
                qi.Enabled = true;
                xigua.Enabled = true;
                mangguo.Enabled = true;
                lingdang.Enabled = true;
                pingguo.Enabled = true;
                gui.Enabled = true;
                juzi.Enabled = true;
            }
            if (int.Parse(jifen.Text) >= 10 && timer1.Enabled == false && timer2.Enabled == false)
            {
                btntuibi.Enabled = true;
            }
            else
            {
                btntuibi.Enabled = true;
            }
            
        }
        int ld1 = 0;

        private void pictureBox8_Click(object sender, EventArgs e)
        {
            ld1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }

        private void pictureBox20_Click(object sender, EventArgs e)
        {

        }


        int a = 0;
        int w = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
           //sj = 231;

            sf ;
            man = sj - 15;
            zhong = man - 30;


            if (a == zhong)
            {
                timer1.Interval = 30;
            }
            if (a == man)
            {
                timer1.Interval = 50;
            }
            if (a % 24 == 0)
            {
                a5.BackColor = Color.Red;
                a6.BackColor = Color.Red;
                a7.BackColor = Color.Red;
                a4.BackColor = Color.Transparent;
            }
            else if (a % 24 == 1)
            {
                a6.BackColor = Color.Red;
                a8.BackColor = Color.Red;
                a7.BackColor = Color.Red;
                a5.BackColor = Color.Transparent;
            }
            else if (a % 24 == 2)
            {
                a7.BackColor = Color.Red;
                a8.BackColor = Color.Red;
                a9.BackColor = Color.Red;
                a6.BackColor = Color.Transparent;
            }
            else if (a % 24 == 3)
            {
                a10.BackColor = Color.Red;
                a9.BackColor = Color.Red;
                a8.BackColor = Color.Red;
                a7.BackColor = Color.Transparent;
            }
            else if (a % 24 == 4)
            {
                a9.BackColor = Color.Red;
                a10.BackColor = Color.Red;
                a11.BackColor = Color.Red;
                a8.BackColor = Color.Transparent;
            }
            else if (a % 24 == 5)
            {
                a10.BackColor = Color.Red;
                a11.BackColor = Color.Red;
                a12.BackColor = Color.Red;
                a9.BackColor = Color.Transparent;
            }
            else if (a % 24 == 6)
            {
                a11.BackColor = Color.Red;
                a12.BackColor = Color.Red;
                a13.BackColor = Color.Red;
                a10.BackColor = Color.Transparent;
            }
            else if (a % 24 == 7)
            {
                a12.BackColor = Color.Red;
                a13.BackColor = Color.Red;
                a14.BackColor = Color.Red;
                a11.BackColor = Color.Transparent;
            }
            else if (a % 24 == 8)
            {
                a13.BackColor = Color.Red;
                a14.BackColor = Color.Red;
                a15.BackColor = Color.Red;
                a12.BackColor = Color.Transparent;
            }
            else if (a % 24 == 9)
            {
                a14.BackColor = Color.Red;
                a15.BackColor = Color.Red;
                a16.BackColor = Color.Red;
                a13.BackColor = Color.Transparent;
            }
            else if (a % 24 == 10)
            {
                a15.BackColor = Color.Red;
                a16.BackColor = Color.Red;
                a17.BackColor = Color.Red;
                a14.BackColor = Color.Transparent;
            }
            else if (a % 24 == 11)
            {
                a16.BackColor = Color.Red;
                a17.BackColor = Color.Red;
                a18.BackColor = Color.Red;
                a15.BackColor = Color.Transparent;
            }
            else if (a % 24 == 12)
            {
                a17.BackColor = Color.Red;
                a18.BackColor = Color.Red;
                a19.BackColor = Color.Red;
                a16.BackColor = Color.Transparent;
            }
            else if (a % 24 == 13)
            {
                a18.BackColor = Color.Red;
                a19.BackColor = Color.Red;
                a20.BackColor = Color.Red;
                a17.BackColor = Color.Transparent;
            }
            else if (a % 24 == 14)
            {
                a19.BackColor = Color.Red;
                a20.BackColor = Color.Red;
                a21.BackColor = Color.Red;
                a18.BackColor = Color.Transparent;
            }
            else if (a % 24 == 15)
            {
                a20.BackColor = Color.Red;
                a21.BackColor = Color.Red;
                a22.BackColor = Color.Red;
                a19.BackColor = Color.Transparent;
            }
            else if (a % 24 == 16)
            {
                a21.BackColor = Color.Red;
                a22.BackColor = Color.Red;
                a23.BackColor = Color.Red;
                a20.BackColor = Color.Transparent;
            }
            else if (a % 24 == 17)
            {
                a22.BackColor = Color.Red;
                a23.BackColor = Color.Red;
                a24.BackColor = Color.Red;
                a21.BackColor = Color.Transparent;
            }
            else if (a % 24 == 18)
            {
                a23.BackColor = Color.Red;
                a24.BackColor = Color.Red;
                a1.BackColor = Color.Red;
                a22.BackColor = Color.Transparent;
            }
            else if (a % 24 == 19)
            {
                a24.BackColor = Color.Red;
                a1.BackColor = Color.Red;
                a2.BackColor = Color.Red;
                a23.BackColor = Color.Transparent;
            }
            else if (a % 24 == 20)
            {
                a1.BackColor = Color.Red;
                a2.BackColor = Color.Red;
                a3.BackColor = Color.Red;
                a24.BackColor = Color.Transparent;
            }
            else if (a % 24 == 21)
            {
                a2.BackColor = Color.Red;
                a3.BackColor = Color.Red;
                a4.BackColor = Color.Red;
                a1.BackColor = Color.Transparent;
            }
            else if (a % 24 == 22)
            {
                a3.BackColor = Color.Red;
                a4.BackColor = Color.Red;
                a5.BackColor = Color.Red;
                a2.BackColor = Color.Transparent;
            }
            else if (a % 24 == 23)
            {
                a4.BackColor = Color.Red;
                a5.BackColor = Color.Red;
                a6.BackColor = Color.Red;
                a3.BackColor = Color.Transparent;
            }
            
            if (sj == a)
            {
                int qq = sj % 24;
                qq = qq 7;
                w = qq % 24;
                if (w == 0)
                {
                    w = 24;
                }
                int w1 = ((w 24) - 1) % 24;
                int w2 = ((w 24) - 2) % 24;
                if (w1 == 0)
                {
                    w1 = 24;
                }
                else if (w1 == -1)
                {
                    w1 = 23;
                }
                if (w2 == 0)
                {
                    w2 = 24;
                }
                else if (w2 == -1)
                {
                    w2 = 23;
                }
                Controls["a" w1].BackColor = Color.Transparent;
                Controls["a" w2].BackColor = Color.Transparent;
                timer1.Enabled = false;

                music.Stop();
                button3.Enabled = true;
                button1.Enabled = true;
                man = 0;
                zhong = 0;
                a = 0;
                timer1.Interval = 1;
                jisuan();



            }
            a ;
        }
        int pg1 = 0;
        private void pingguo_Click(object sender, EventArgs e)
        {
            pg1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int mg1 = 0;
        private void mangguo_Click(object sender, EventArgs e)
        {
            mg1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int xi = 0;
        private void xigua_Click(object sender, EventArgs e)
        {
            xi ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int qi1 = 0;
        private void qi_Click(object sender, EventArgs e)
        {
            qi1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int xx1 = 0;
        private void xing_Click(object sender, EventArgs e)
        {
            xx1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int sf = 0;
        SoundPlayer music;
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            button3.Enabled = false;
            music = new SoundPlayer(@"D:\FFOutput\开始.wav");
            music.Play();

            if (sf != 0)
            {
                Controls["a" w].BackColor = Color.Transparent;
            }
            Random ran = new Random();
            sj = ran.Next(150, 250);

            timer1.Enabled = true;




        }
        Random pao;
        int[] sz = new int[8];
        private void jisuan()
        {
            if (w == 6 || w == 9 || w == 12 || w == 15 || w == 18 || w == 21 || w == 24)//2倍            
            {
                if (w == 6)
                {
                    jifen.Text = (int.Parse(jifen.Text) pg1 * 2).ToString();
                }
                else if (w == 9)
                {
                    jifen.Text = (int.Parse(jifen.Text) xi * 2).ToString();
                }
                else if (w == 12)
                {
                    jifen.Text = (int.Parse(jifen.Text) ju1 * 2).ToString();
                }
                else if (w == 15)
                {
                    jifen.Text = (int.Parse(jifen.Text) qi1 * 2).ToString();
                }
                else if (w == 18)
                {
                    jifen.Text = (int.Parse(jifen.Text) mg1 * 2).ToString();
                }
                else if (w == 21)
                {
                    jifen.Text = (int.Parse(jifen.Text) xx1 * 2).ToString();
                }
                else if (w == 24)
                {
                    jifen.Text = (int.Parse(jifen.Text) ld1 * 2).ToString();
                }
            }
            else if (w == 1 || w == 2 || w == 13 || w == 7 || w == 14 || w == 19) //10倍
            {
                if (w == 1)
                {
                    jifen.Text = (int.Parse(jifen.Text) ju1 * 10).ToString();
                }
                else if (w == 2)
                {
                    jifen.Text = (int.Parse(jifen.Text) ld1 * 10).ToString();
                }
                else if (w == 13)
                {
                    jifen.Text = (int.Parse(jifen.Text) ju1 * 10).ToString();
                }
                else if (w == 7)
                {
                    jifen.Text = (int.Parse(jifen.Text) mg1 * 10).ToString();
                }
                else if (w == 14)
                {
                    jifen.Text = (int.Parse(jifen.Text) ld1 * 10).ToString();
                }
                else if (w == 19)
                {
                    jifen.Text = (int.Parse(jifen.Text) mg1 * 10).ToString();
                }
            }
            else if (w == 5 || w == 11 || w == 17 || w == 23) //5倍
            {
                jifen.Text = (int.Parse(jifen.Text) pg1 * 5).ToString();
            }
            else if (w == 8 || w == 16 || w == 20) //20倍
            {
                if (w == 8)
                {
                    jifen.Text = (int.Parse(jifen.Text) xi * 20).ToString();
                }
                else if (w == 16)
                {
                    jifen.Text = (int.Parse(jifen.Text) qi1 * 20).ToString();
                }
                else
                {
                    jifen.Text = (int.Parse(jifen.Text) xx1 * 20).ToString();
                }
            }
            else if (w == 3) //25倍
            {
                jifen.Text = (int.Parse(jifen.Text) wang1 * 25).ToString();
                timer2.Enabled = true;

            }
            else if (w == 4)      //50倍
            {
                jifen.Text = (int.Parse(jifen.Text) wang1 * 50).ToString();
                timer2.Enabled = true;
            }
            else                    //跑马灯
            {


                timer2.Enabled = true;

            }

            sz[0] = wang1;
            sz[1] = xx1;
            sz[2] = qi1;
            sz[3] = xi;
            sz[4] = mg1;
            sz[5] = ld1;
            sz[6] = ju1;
            sz[7] = pg1;
            if (timer2.Enabled == false)
            {
                wang1 = 0;
                xx1 = 0;
                qi1 = 0;
                xi = 0;
                mg1 = 0;
                ld1 = 0;
                ju1 = 0;
                pg1 = 0;

            }
            gengxin();
        }

        private void xx_TextChanged(object sender, EventArgs e)
        {
            gengxin();
        }

        private void q_TextChanged(object sender, EventArgs e)
        {
            gengxin();
        }

        private void xg_TextChanged(object sender, EventArgs e)
        {
            gengxin();
        }

        private void mg_TextChanged(object sender, EventArgs e)
        {
            gengxin();
        }

        private void ld_TextChanged(object sender, EventArgs e)
        {
            gengxin();
        }

        private void pg_TextChanged(object sender, EventArgs e)
        {
            gengxin();
        }

        private void jifen_TextChanged(object sender, EventArgs e)
        {
            if (int.Parse(jifen.Text) < 0)
            {
                jifen.Text = "0";
            }
        }
        int t = 0;
        private void button2_Click(object sender, EventArgs e)
        {
            if (t > 0)
            {
                jifen.Text = (int.Parse(jifen.Text) 10).ToString();
                string sql = "update shuiguoji set cishu=cishu-1 where kahao=" kahao "";
                int a = DBHelper.ExecuteNonQuery(sql);
                gengxin();
            }
            else if (t <= 0 && jifen.Text == "0")
            {
                MessageBox.Show("积分用完了!!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
        int ju1 = 0;
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            ju1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int wang1 = 0;
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            wang1 ;
            jifen.Text = (int.Parse(jifen.Text) - 1).ToString();
            gengxin();
        }
        int zong = 0;
        SoundPlayer music2;
        private void button3_Click(object sender, EventArgs e)
        {
            music = new SoundPlayer(@"D:\FFOutput\开始.wav");
            music.Play();
            for (int i = 0; i < 8; i )
            {
                zong = sz[i] zong;
            }
            if (int.Parse(jifen.Text) >= zong)
            {
                wang1 = sz[0];
                xx1 = sz[1];
                qi1 = sz[2];
                xi = sz[3];
                mg1 = sz[4];
                ld1 = sz[5];
                ju1 = sz[6];
                pg1 = sz[7];
                jifen.Text = (int.Parse(jifen.Text) - zong).ToString();
                zong = 0;
                gengxin();
            }
            button1.Enabled = false;
            button3.Enabled = false;
            Controls["a" w].BackColor = Color.Transparent;
            Random ran = new Random();
            sj = ran.Next(150, 250);

            timer1.Enabled = true;

        }
        int ma = 0;
        int s = 0;
        int din = 0;
        SoundPlayer music1;
        SoundPlayer music3;
        //SoundPlayer music4;
        //SoundPlayer music5;
       // SoundPlayer music6;
        private void timer2_Tick(object sender, EventArgs e)
        {
            
            if (din == 0)
            {
                music1 = new SoundPlayer(@"D:\FFOutput\打枪.wav");
                music1.Play();
                pao = new Random();
                sj = pao.Next(80, 150);
                din ;
            }

            if (ma <= 23)
            {
                if (ma == 0)
                {
                    timer2.Interval = 30;
                }
                if (ma % 2 == 0)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                }
                else
                {
                    Controls["a" w].BackColor = Color.Red;
                }


                if (ma == 23)
                {
                    timer2.Interval = 30;
                    music1.Stop();
                   // music6 = new SoundPlayer(@"D:\FFOutput\连接.wav");
                    //music6.Play();
                }
            }
            
            
            if(ma==46){
                //music5 = new SoundPlayer(@"D:\FFOutput\连接.wav");
                music3 = new SoundPlayer(@"D:\FFOutput\打枪后.wav");
                music3.Play();
            }
            if (ma <= 47 && ma > 23)
            {
                if (ma % 24 == 0)
                {
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 1)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    //Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 2)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 3)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 4)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 5)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 6)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 7)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 8)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    //  Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 9)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 10)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    //  Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 11)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 12)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    //Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 13)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 14)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 15)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 16)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    //  Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 17)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 18)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 19)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 20)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    // Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 21)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 22)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    //Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 23)
                {
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                if (ma == 45)
                {
               
                   /* music4 = new SoundPlayer(@"D:\FFOutput\连接.wav");
                    music4.Play();*/
                }
            }
            else if (ma > 47)
            {
                /*if(ma==100){
                  
                }
                if(ma==70){
                    music5 = new SoundPlayer(@"D:\FFOutput\连接.wav");
                    music5.Play();
                }
                if(ma==120){
                    
                }
                if(ma==100){
                    
                }*/
                if (ma % 24 == 0)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;

                }
                else if (ma % 24 == 1)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 2)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 3)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 4)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 5)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 6)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 7)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 8)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 9)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 10)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 11)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 12)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 13)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 14)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 15)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 16)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 17)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 18)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 19)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 20)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 21)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 22)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
                else if (ma % 24 == 23)
                {
                    Controls["a" w].BackColor = Color.Transparent;
                    w = w - 1;
                    if (w == 0)
                    {
                        w = 24;
                    }
                    Controls["a" w].BackColor = Color.Red;
                }
            }
            if (ma == sj)
            {

                sj = 0;
                ma = 0;
                din = 0;
                timer2.Enabled = false;
                music3.Stop();
                paomadeng();

            }
            ma ;
        }

        private void paomadeng()
        {
            if (w == 6 || w == 9 || w == 12 || w == 15 || w == 18 || w == 21 || w == 24)//2倍            
            {
                if (w == 6)
                {
                    jifen.Text = (int.Parse(jifen.Text) pg1 * 2).ToString();
                }
                else if (w == 9)
                {
                    jifen.Text = (int.Parse(jifen.Text) xi * 2).ToString();
                }
                else if (w == 12)
                {
                    jifen.Text = (int.Parse(jifen.Text) ju1 * 2).ToString();
                }
                else if (w == 15)
                {
                    jifen.Text = (int.Parse(jifen.Text) qi1 * 2).ToString();
                }
                else if (w == 18)
                {
                    jifen.Text = (int.Parse(jifen.Text) mg1 * 2).ToString();
                }
                else if (w == 21)
                {
                    jifen.Text = (int.Parse(jifen.Text) xx1 * 2).ToString();
                }
                else if (w == 24)
                {
                    jifen.Text = (int.Parse(jifen.Text) ld1 * 2).ToString();
                }
            }
            else if (w == 1 || w == 2 || w == 13 || w == 7 || w == 14 || w == 19) //10倍
            {
                if (w == 1)
                {
                    jifen.Text = (int.Parse(jifen.Text) ju1 * 10).ToString();
                }
                else if (w == 2)
                {
                    jifen.Text = (int.Parse(jifen.Text) ld1 * 10).ToString();
                }
                else if (w == 13)
                {
                    jifen.Text = (int.Parse(jifen.Text) ju1 * 10).ToString();
                }
                else if (w == 7)
                {
                    jifen.Text = (int.Parse(jifen.Text) mg1 * 10).ToString();
                }
                else if (w == 14)
                {
                    jifen.Text = (int.Parse(jifen.Text) ld1 * 10).ToString();
                }
                else if (w == 19)
                {
                    jifen.Text = (int.Parse(jifen.Text) mg1 * 10).ToString();
                }
            }
            else if (w == 5 || w == 11 || w == 17 || w == 23) //5倍
            {
                jifen.Text = (int.Parse(jifen.Text) pg1 * 5).ToString();
            }
            else if (w == 8 || w == 16 || w == 20) //20倍
            {
                if (w == 8)
                {
                    jifen.Text = (int.Parse(jifen.Text) xi * 20).ToString();
                }
                else if (w == 16)
                {
                    jifen.Text = (int.Parse(jifen.Text) qi1 * 20).ToString();
                }
                else
                {
                    jifen.Text = (int.Parse(jifen.Text) xx1 * 20).ToString();
                }
            }
            else if (w == 3) //25倍
            {
                jifen.Text = (int.Parse(jifen.Text) wang1 * 25).ToString();

            }
            else if (w == 4)      //50倍
            {
                jifen.Text = (int.Parse(jifen.Text) wang1 * 50).ToString();

            }
            else                    //跑马灯
            {


            }
            wang1 = 0;
            xx1 = 0;
            qi1 = 0;
            xi = 0;
            mg1 = 0;
            ld1 = 0;
            ju1 = 0;
            pg1 = 0;
            gengxin();
        }

        private void cishu_Click(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            int fen = int.Parse(jifen.Text);
            while (fen >= 10)
            {
                jifen.Text = (fen - 10).ToString();
                string sql = "update shuiguoji set cishu=cishu 1 where kahao=" kahao "";
                int a = DBHelper.ExecuteNonQuery(sql);
                fen = fen - 10;
            }
            gengxin();
            

        }

        private void button5_Click(object sender, EventArgs e)
        {
           
            if (int.Parse(jifen.Text) > 0)
            {
                DialogResult a = MessageBox.Show("您还有积分留在机器,退出将丢失,是否仍要退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (a == DialogResult.Yes)
                {
                    this.Close();
                }
            }
            else
            {
                DialogResult b = MessageBox.Show("确定退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (b == DialogResult.Yes)
                {
                    this.Close();
                }
            }
        }

标签: WinFrom

实例下载地址

winform老虎机

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
;
报警