程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> 關於C# >> C#寫一個雙色球模擬器 喜歡的朋友過來看看

C#寫一個雙色球模擬器 喜歡的朋友過來看看

編輯:關於C#
 

代碼如下:

 

namespace 雙色球單式
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
timer1.Start();

}

private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}

private void timer1_Tick(object sender, EventArgs e)
{
Random r = new Random();
int x;
x = r.Next(1, 33);
string a = x == 1 ? "01" : x == 2 ? "02" : x == 3 ? "03" : x == 4 ? "04" : x == 5 ? "05" : x == 6 ? "06" : x == 7 ? "07" : x == 8 ? "08" : x == 9 ? "09" : x.ToString();
x = r.Next(1, 33);
string b = x == 1 ? "01" : x == 2 ? "02" : x == 3 ? "03" : x == 4 ? "04" : x == 5 ? "05" : x == 6 ? "06" : x == 7 ? "07" : x == 8 ? "08" : x == 9 ? "09" : x.ToString();
x = r.Next(1, 33);
string c = x == 1 ? "01" : x == 2 ? "02" : x == 3 ? "03" : x == 4 ? "04" : x == 5 ? "05" : x == 6 ? "06" : x == 7 ? "07" : x == 8 ? "08" : x == 9 ? "09" : x.ToString();
x = r.Next(1, 33);
string d = x == 1 ? "01" : x == 2 ? "02" : x == 3 ? "03" : x == 4 ? "04" : x == 5 ? "05" : x == 6 ? "06" : x == 7 ? "07" : x == 8 ? "08" : x == 9 ? "09" : x.ToString();
x = r.Next(1, 33);
string t = x == 1 ? "01" : x == 2 ? "02" : x == 3 ? "03" : x == 4 ? "04" : x == 5 ? "05" : x == 6 ? "06" : x == 7 ? "07" : x == 8 ? "08" : x == 9 ? "09" : x.ToString();
x = r.Next(1, 33);
string m = x == 1 ? "01" : x == 2 ? "02" : x == 3 ? "03" : x == 4 ? "04" : x == 5 ? "05" : x == 6 ? "06" : x== 7 ? "07" : x== 8 ? "08" : x == 9 ? "09" : x.ToString();
label1.Text = a;
label2.Text = b;
label3.Text = c;
label4.Text = d;
label5.Text = t;
label6.Text = m;

 

Random h = new Random();
int k;
k = h.Next(1, 16);
string n = k == 1 ? "01" : k == 2 ? "02" : k == 3 ? "03" : k == 4 ? "04" : k == 5 ? "05" : k == 6 ? "06" : k == 7 ? "07" : k == 8 ? "08" : k == 9 ? "09" : k.ToString();
label7.Text = n;
}

private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("提示將要推出程序");
this.Close();
}
}
}

C#寫一個雙色球模擬器 喜歡的朋友過來看看
C#寫一個雙色球模擬器 喜歡的朋友過來看看

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved