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();
}
}
}