上機課堂隨機抽號小程序,選擇困難症的福音!


hhhhhh,今天寫了一個抽幸運er的小程序,選擇困難症再也不用考慮上課提問哪一個同學了!(源代碼見最后)

源代碼:(只是用了一個簡單的Random函數抽號[沒有去重],下一步准備把學生名字放進去)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace num
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.BackgroundImage = Image.FromFile("1.jpg");
            this.Text = "幸運鵝";
            this.Icon = new System.Drawing.Icon("2.ico");
        }

        private void Form1_Load(object sender, EventArgs e)
        {           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Random rd = new Random();
            label1.Text = rd.Next(1,40).ToString();
        }
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM