zoukankan      html  css  js  c++  java
  • 【windows】制作幸运“Tiger”机

    基本图片

     

     

    核心代码

      1 using System;
      2 using System.Collections.Generic;
      3 using System.ComponentModel;
      4 using System.Data;
      5 using System.Drawing;
      6 using System.Linq;
      7 using System.Text;
      8 using System.Threading.Tasks;
      9 using System.Windows.Forms;
     10 
     11 namespace WindowsFormsApp1
     12 {
     13     public partial class Form1 : Form
     14     {
     15         public Form1()
     16         {
     17             InitializeComponent();
     18         }
     19         int flag = -1;
     20         int D1 = -1 , D2 = -1 , D3 = -1;
     21         private void button1_Click(object sender, EventArgs e)
     22         {
     23             flag++;
     24             if( flag == 0)
     25             {
     26                 timer1.Enabled = true;
     27                 timer2.Enabled = true;
     28                 timer3.Enabled = true;
     29             }
     30             else if( flag == 1)
     31             {
     32                 timer1.Stop();
     33                 Text = D1.ToString();
     34             }
     35             else if( flag == 2)
     36             {
     37                 timer2.Stop();
     38                 Text = D1.ToString();
     39             }
     40             else if( flag == 3)
     41             {
     42                 timer3.Stop();
     43                 Text = D1.ToString();
     44             }
     45             else
     46             { 
     47 
     48                 int t = D1 * 100 + D2 * 10 + D3;
     49                 Text = t.ToString();
     50                 if( t == 111)
     51                 {
     52                     MessageBox.Show("Apple", "获奖", MessageBoxButtons.OK);
     53                 }else if( t == 222)
     54                 {
     55                     MessageBox.Show("Lemon", "获奖", MessageBoxButtons.OK);
     56                 }else if( t == 333)
     57                 {
     58                     MessageBox.Show("Grape", "获奖", MessageBoxButtons.OK);
     59                 }
     60                 else
     61                 {
     62                     MessageBox.Show("很遗憾", "未获奖", MessageBoxButtons.OK);
     63                 }
     64                 flag = -1;
     65                 timer1.Start();
     66                 timer2.Start();
     67                 timer3.Start();
     68             }
     69         }
     70 
     71         private void timer1_Tick(object sender, EventArgs e)
     72         {
     73             Random rand = new Random();
     74             int k = rand.Next(3);
     75             switch (k)
     76             {
     77                 case 0:
     78                     pictureBox1.Image = Properties.Resources.apple;
     79                     break;
     80                 case 1:
     81                     pictureBox1.Image = Properties.Resources.lemon;
     82                     break;
     83                 case 2:
     84                     pictureBox1.Image = Properties.Resources.grape;
     85                     break;
     86             }
     87             D1 = k+1; 
     88         }
     89 
     90         private void timer2_Tick(object sender, EventArgs e)
     91         {
     92             Random rand = new Random();
     93             int k = rand.Next(3);
     94             switch (k)
     95             {
     96                 case 0:
     97                     pictureBox2.Image = Properties.Resources.apple;
     98                     break;
     99                 case 1:
    100                     pictureBox2.Image = Properties.Resources.lemon;
    101                     break;
    102                 case 2:
    103                     pictureBox2.Image = Properties.Resources.grape;
    104                     break;
    105             }
    106             D2 = k+1;
    107         }
    108 
    109         private void timer3_Tick(object sender, EventArgs e)
    110         {
    111             Random rand = new Random();
    112             int k = rand.Next(3);
    113             switch (k)
    114             {
    115                 case 0:
    116                     pictureBox3.Image = Properties.Resources.apple;
    117                     break;
    118                 case 1:
    119                     pictureBox3.Image = Properties.Resources.lemon;
    120                     break;
    121                 case 2:
    122                     pictureBox3.Image = Properties.Resources.grape;
    123                     break;
    124             }
    125             D3 = k+1;
    126         }
    127     }
    128 }
    核心代码

    效果图

  • 相关阅读:
    Payload Header到底是什么
    usb bulk传输和同步传输
    Video streaming interface 带宽的选择
    Methyl-SeqDNA的甲基化图谱|DNase I-Seq|ChIP-Seq|3C-Seq|
    连词词组|relax|brings about a rise in|Chance are (high)that|Have no clue|Be passionate about|Tedious|overwhelmed by piles of
    body书写总框架
    单个body|简单解释|复杂解释|反面解释
    TS写法
    saturates|meteoric|enclose|marooned|predators|Pioneer community|salinization|condenser|embodied
    否定事实信息题
  • 原文地址:https://www.cnblogs.com/Osea/p/12470249.html
Copyright © 2011-2022 走看看