2016年10月20日 星期四



public partial class Form1 : Form
    {
        private void button1_Click(object sender, EventArgs e)
        {
            switch (new Random().Next(3))
            {
                case 0:
                    label1.Text = "1";
                    pictureBox1.Image = WindowsFormsApplication1.Properties.Resources._1;
                    break;
                case 1:
                    label1.Text = "2";
                    pictureBox1.Image = WindowsFormsApplication1.Properties.Resources._2;
                    break;
                case 2:
                    label1.Text = "3";
                    pictureBox1.Image = WindowsFormsApplication1.Properties.Resources._3;
                    break;
            }
        }
    }

沒有留言:

張貼留言