程式設計工藝大師
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: 這行程式碼會將資料載入 'db1DataSet1.DataTable2' 資料表。您可以視需要進行移動或移除。
this.dataTable2TableAdapter.Fill(this.db1DataSet1.DataTable2);
// TODO: 這行程式碼會將資料載入 'db1DataSet.DataTable2' 資料表。您可以視需要進行移動或移除。
this.dataTable2TableAdapter.Fill(this.db1DataSet.DataTable2);
// TODO: 這行程式碼會將資料載入 'db1DataSet.person' 資料表。您可以視需要進行移動或移除。
this.personTableAdapter.Fill(this.db1DataSet.person);
// TODO: 這行程式碼會將資料載入 'db1DataSet.DataTable1' 資料表。您可以視需要進行移動或移除。
this.dataTable1TableAdapter.Fill(this.db1DataSet.DataTable1);
// TODO: 這行程式碼會將資料載入 'db1DataSet.record' 資料表。您可以視需要進行移動或移除。
this.recordTableAdapter.Fill(this.db1DataSet.record);
}
private void button1_Click(object sender, EventArgs e)
{
// If you are not at the end of the list, move to the next item
// in the BindingSource.
if (bindingSource5.Position + 1 < bindingSource5.Count)
bindingSource5.MoveNext();
// Otherwise, move back to the first item.
else
bindingSource5.MoveFirst();
// Force the form to repaint.
this.Invalidate();
}
private void button2_Click(object sender, EventArgs e)
{
// If you are not at the end of the list, move to the next item
// in the BindingSource.
if (bindingSource5.Position - 1 < 0)
bindingSource5.MoveLast();
// Otherwise, move back to the first item.
else
bindingSource5.MovePrevious();
// Force the form to repaint.
this.Invalidate();
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.DataBindings.Add("Text", bindingSource5, "chinese");
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text();
}
}
}
2015年12月4日 星期五
2015年11月20日 星期五
datagridview part1 D0250565 蔡坤成
程式設計工藝大師
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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: 這行程式碼會將資料載入 '資料庫2DataSet.custermer' 資料表。您可以視需要進行移動或移除。
this.custermerTableAdapter.Fill(this.資料庫2DataSet.custermer);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: 這行程式碼會將資料載入 '資料庫2DataSet.custermer' 資料表。您可以視需要進行移動或移除。
this.custermerTableAdapter.Fill(this.資料庫2DataSet.custermer);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
2015年11月6日 星期五
計算機part2 D0250565 蔡坤成
程式設計工藝大師
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int n=1;
float a , b,c;
float[] d = new float[30];
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 1;
textBox1.Text = "";
}
private void label3_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 2;
textBox1.Text = "";
}
private void button5_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 3;
textBox1.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 4;
textBox1.Text = "";
}
private void button4_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (1/a).ToString();
textBox1.Text = label3.Text;
c = 5;
}
private void button2_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (a*a).ToString();
textBox1.Text = label3.Text;
c = 6;
}
private void button7_Click(object sender, EventArgs e)
{
b = float.Parse(textBox1.Text);
if (c == 1)
{
label3.Text = (a + b).ToString();
}
else if (c == 2)
{
label3.Text = (a - b).ToString();
}
else if (c == 3)
{
label3.Text = (a * b).ToString();
}
else if (c == 4)
{
if (b == 0)
{
label3.Text = "分母不能為零";
}
else
{
label3.Text = (a / b).ToString();
}
}
else
{
textBox1.Text = label3.Text;
}
textBox1.Text = label3.Text;
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text="";
label3.Text = "";
n = 1;
}
private void button18_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + ".";
d[n] = float.Parse(textBox1.Text);
}
private void button19_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "0";
d[n] = float.Parse(textBox1.Text);
}
private void button15_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "1";
d[n] = float.Parse(textBox1.Text);
}
private void button14_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "2";
d[n] = float.Parse(textBox1.Text);
}
private void button17_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "3";
d[n] = float.Parse(textBox1.Text);
}
private void button11_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "4";
d[n] = float.Parse(textBox1.Text);
}
private void button10_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "5";
d[n] = float.Parse(textBox1.Text);
}
private void button16_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "6";
d[n] = float.Parse(textBox1.Text);
}
private void button9_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "7";
d[n] = float.Parse(textBox1.Text);
}
private void button13_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "8";
d[n] = float.Parse(textBox1.Text);
}
private void button12_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "9";
d[n] = float.Parse(textBox1.Text);
}
private void button20_Click(object sender, EventArgs e)
{
if (n <= 1)
{
textBox1.Text = "";
}
else
{
textBox1.Text = d[n-1].ToString();
n = n - 1;
}
}
}
}
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int n=1;
float a , b,c;
float[] d = new float[30];
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 1;
textBox1.Text = "";
}
private void label3_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 2;
textBox1.Text = "";
}
private void button5_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 3;
textBox1.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 4;
textBox1.Text = "";
}
private void button4_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (1/a).ToString();
textBox1.Text = label3.Text;
c = 5;
}
private void button2_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (a*a).ToString();
textBox1.Text = label3.Text;
c = 6;
}
private void button7_Click(object sender, EventArgs e)
{
b = float.Parse(textBox1.Text);
if (c == 1)
{
label3.Text = (a + b).ToString();
}
else if (c == 2)
{
label3.Text = (a - b).ToString();
}
else if (c == 3)
{
label3.Text = (a * b).ToString();
}
else if (c == 4)
{
if (b == 0)
{
label3.Text = "分母不能為零";
}
else
{
label3.Text = (a / b).ToString();
}
}
else
{
textBox1.Text = label3.Text;
}
textBox1.Text = label3.Text;
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text="";
label3.Text = "";
n = 1;
}
private void button18_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + ".";
d[n] = float.Parse(textBox1.Text);
}
private void button19_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "0";
d[n] = float.Parse(textBox1.Text);
}
private void button15_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "1";
d[n] = float.Parse(textBox1.Text);
}
private void button14_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "2";
d[n] = float.Parse(textBox1.Text);
}
private void button17_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "3";
d[n] = float.Parse(textBox1.Text);
}
private void button11_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "4";
d[n] = float.Parse(textBox1.Text);
}
private void button10_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "5";
d[n] = float.Parse(textBox1.Text);
}
private void button16_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "6";
d[n] = float.Parse(textBox1.Text);
}
private void button9_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "7";
d[n] = float.Parse(textBox1.Text);
}
private void button13_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "8";
d[n] = float.Parse(textBox1.Text);
}
private void button12_Click(object sender, EventArgs e)
{
n = n + 1;
textBox1.Text = textBox1.Text + "9";
d[n] = float.Parse(textBox1.Text);
}
private void button20_Click(object sender, EventArgs e)
{
if (n <= 1)
{
textBox1.Text = "";
}
else
{
textBox1.Text = d[n-1].ToString();
n = n - 1;
}
}
}
}
2015年11月5日 星期四
計算機 D0250565 蔡坤成
程式設計工藝大師
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
float a , b,c;
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 1;
textBox1.Text = "";
}
private void label3_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 2;
textBox1.Text = "";
}
private void button5_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 3;
textBox1.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 4;
textBox1.Text = "";
}
private void button4_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (1/a).ToString();
textBox1.Text = label3.Text;
c = 5;
}
private void button2_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (a*a).ToString();
textBox1.Text = label3.Text;
c = 6;
}
private void button7_Click(object sender, EventArgs e)
{
b = float.Parse(textBox1.Text);
if (c == 1)
{
label3.Text = (a + b).ToString();
}
else if (c == 2)
{
label3.Text = (a - b).ToString();
}
else if (c == 3)
{
label3.Text = (a * b).ToString();
}
else if (c == 4)
{
if (b == 0)
{
label3.Text = "分母不能為零";
}
else
{
label3.Text = (a / b).ToString();
}
}
else
{
textBox1.Text = label3.Text;
}
textBox1.Text = label3.Text;
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text="";
label3.Text = "";
}
}
}
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
float a , b,c;
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 1;
textBox1.Text = "";
}
private void label3_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 2;
textBox1.Text = "";
}
private void button5_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 3;
textBox1.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
c = 4;
textBox1.Text = "";
}
private void button4_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (1/a).ToString();
textBox1.Text = label3.Text;
c = 5;
}
private void button2_Click(object sender, EventArgs e)
{
a = float.Parse(textBox1.Text);
label3.Text = (a*a).ToString();
textBox1.Text = label3.Text;
c = 6;
}
private void button7_Click(object sender, EventArgs e)
{
b = float.Parse(textBox1.Text);
if (c == 1)
{
label3.Text = (a + b).ToString();
}
else if (c == 2)
{
label3.Text = (a - b).ToString();
}
else if (c == 3)
{
label3.Text = (a * b).ToString();
}
else if (c == 4)
{
if (b == 0)
{
label3.Text = "分母不能為零";
}
else
{
label3.Text = (a / b).ToString();
}
}
else
{
textBox1.Text = label3.Text;
}
textBox1.Text = label3.Text;
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text="";
label3.Text = "";
}
}
}
2015年10月30日 星期五
推盤遊戲 Ver 2.0 D0250565 蔡坤成
程式設計工藝大師
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
Button[,]Buttons = new System.Windows.Forms.Button[5,5];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 1; i < 5; i++)
{
for (int j = 1; j < 5; j++)
{
Buttons[i, j] = new Button();
Buttons[i, j].Size = new Size(50, 50);
Buttons[i, j].Location = new Point(i * 50, j * 50);
this.Controls.Add(Buttons[i, j]);//出現在畫面中
}
}
}
private void button1_Click(object sender, EventArgs e)
{
int o=0,c,f;
Random rnd = new Random();
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0};
for (int i = 0; i < 16; ++i)
{
int j = rnd.Next(15);
int t = a[j];
a[j] = a[i];
a[i] = t;
}
for (int h = 1; h < 5; h++)
{
for (int v = 1; v < 5; v++)
{
Buttons[h, v].Text = a[o].ToString();
o = o + 1;
}
}
for (int k = 0; k < 16; ++k)
{
if (a[k] == 0)
{
c = k % 4 +1;
f = k / 4 +1;
Buttons[f, c].Text = " ";
}
}
}
private void button2_Click(object sender, EventArgs e)
{
int o = 0;
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
for (int h = 1; h < 5; h++)
{
for (int v = 1; v < 5; v++)
{
Buttons[v, h].Text = a[o].ToString();
o = o + 1;
}
}
Buttons[4, 4].Text = " ";
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
}
}
}
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
Button[,]Buttons = new System.Windows.Forms.Button[5,5];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 1; i < 5; i++)
{
for (int j = 1; j < 5; j++)
{
Buttons[i, j] = new Button();
Buttons[i, j].Size = new Size(50, 50);
Buttons[i, j].Location = new Point(i * 50, j * 50);
this.Controls.Add(Buttons[i, j]);//出現在畫面中
}
}
}
private void button1_Click(object sender, EventArgs e)
{
int o=0,c,f;
Random rnd = new Random();
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0};
for (int i = 0; i < 16; ++i)
{
int j = rnd.Next(15);
int t = a[j];
a[j] = a[i];
a[i] = t;
}
for (int h = 1; h < 5; h++)
{
for (int v = 1; v < 5; v++)
{
Buttons[h, v].Text = a[o].ToString();
o = o + 1;
}
}
for (int k = 0; k < 16; ++k)
{
if (a[k] == 0)
{
c = k % 4 +1;
f = k / 4 +1;
Buttons[f, c].Text = " ";
}
}
}
private void button2_Click(object sender, EventArgs e)
{
int o = 0;
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
for (int h = 1; h < 5; h++)
{
for (int v = 1; v < 5; v++)
{
Buttons[v, h].Text = a[o].ToString();
o = o + 1;
}
}
Buttons[4, 4].Text = " ";
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
}
}
}
2015年10月23日 星期五
推盤遊戲 D0250565 蔡坤成
程式設計工藝大師
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
button5.Enabled = false;
button6.Enabled = false;
button7.Enabled = false;
button8.Enabled = false;
button9.Enabled = false;
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button10_Click(object sender, EventArgs e)
{
Random rnd = new Random();
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int i = 0; i < 9; ++i)
{
int j = rnd.Next(8);
int t = a[j];
a[j] = a[i];
a[i] = t;
}
button1.Text = a[0].ToString();
button2.Text = a[1].ToString();
button3.Text = a[2].ToString();
button4.Text = a[3].ToString();
button5.Text = a[4].ToString();
button6.Text = a[5].ToString();
button7.Text = a[6].ToString();
button8.Text = a[7].ToString();
button9.Text = a[8].ToString();
}
}
}
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
button5.Enabled = false;
button6.Enabled = false;
button7.Enabled = false;
button8.Enabled = false;
button9.Enabled = false;
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button10_Click(object sender, EventArgs e)
{
Random rnd = new Random();
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int i = 0; i < 9; ++i)
{
int j = rnd.Next(8);
int t = a[j];
a[j] = a[i];
a[i] = t;
}
button1.Text = a[0].ToString();
button2.Text = a[1].ToString();
button3.Text = a[2].ToString();
button4.Text = a[3].ToString();
button5.Text = a[4].ToString();
button6.Text = a[5].ToString();
button7.Text = a[6].ToString();
button8.Text = a[7].ToString();
button9.Text = a[8].ToString();
}
}
}
2015年10月2日 星期五
D0250565 蔡坤成 紅綠燈
程式設計工藝大師
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c=0 ,d=4,f=0,g=2;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
button1.Text = g.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
c = c + 1;
if (c <= 4)
{
button4.BackColor=System.Drawing.Color.FromName("Green");
d=d-1;
button4.Text = d.ToString();
}
else if (c <= 7)
{
button3.BackColor = System.Drawing.Color.FromName("Yellow");
button4.BackColor = System.Drawing.Color.FromName("White");
d=0;
button3.Text = d.ToString();
}
else if (c<=10)
{
button1.BackColor = System.Drawing.Color.FromName("Red");
button3.BackColor = System.Drawing.Color.FromName("White");
button1.Text = g.ToString();
g=g-1;
}
else
{
c = 0;
d = 4;
g = 2;
button1.BackColor = System.Drawing.Color.FromName("White");
button4.BackColor = System.Drawing.Color.FromName("Green");
}
}
}
}
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c=0 ,d=4,f=0,g=2;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
button1.Text = g.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
c = c + 1;
if (c <= 4)
{
button4.BackColor=System.Drawing.Color.FromName("Green");
d=d-1;
button4.Text = d.ToString();
}
else if (c <= 7)
{
button3.BackColor = System.Drawing.Color.FromName("Yellow");
button4.BackColor = System.Drawing.Color.FromName("White");
d=0;
button3.Text = d.ToString();
}
else if (c<=10)
{
button1.BackColor = System.Drawing.Color.FromName("Red");
button3.BackColor = System.Drawing.Color.FromName("White");
button1.Text = g.ToString();
g=g-1;
}
else
{
c = 0;
d = 4;
g = 2;
button1.BackColor = System.Drawing.Color.FromName("White");
button4.BackColor = System.Drawing.Color.FromName("Green");
}
}
}
}
訂閱:
文章 (Atom)