10517532_985433801473418_6811056821801603129_n

 10686737_985433384806793_6681232654538045225_n  

a0930063623 發表在 痞客邦 留言(0) 人氣()

10301304_976212125728919_4547780257398149311_n  

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

a0930063623 發表在 痞客邦 留言(0) 人氣()

1901463_971592982857500_5207217161816687978_n

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

a0930063623 發表在 痞客邦 留言(0) 人氣()

10710658_971575109525954_6288906228377483366_n  

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

a0930063623 發表在 痞客邦 留言(0) 人氣()

『目標』假設一button為車子,藉由按鍵觸發使其左右移動

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c;
int d = 1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
button1.Left = 100*c;
if(button1.Left>460)
{
d = -1;
}
if (button1.Left < 0)
{
d = 1;
}
c = c + d;
}
}
}

a0930063623 發表在 痞客邦 留言(0) 人氣()

『目標』建立紅綠燈燈號轉換功能,藉由按鍵觸發開關1417793650-86234926_n

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c, r;
public Form1()
{
InitializeComponent();
c = 0;
}
private void button2_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 3;
label1.Text = "r=" + r;
if (r == 0)
{
button1.Location = new Point(0, 0);
button2.BackColor = Color.Black;
}
if (r == 1)
{
button1.Location = new Point(0, 0);
button2.BackColor = Color.Black;
}
else
{
button1.Location = new Point(100, 0);
button2.BackColor = Color.Yellow;
}
}
private void button3_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 3;
label1.Text = "r=" + r;
if (r == 0)
{
button1.Location = new Point(0, 0);
button3.BackColor = Color.Black;
}
if (r == 1)
{
button1.Location = new Point(0, 0);
button3.BackColor = Color.Red;
}
else
{
button1.Location = new Point(100, 0);
button3.BackColor = Color.Black;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
c = c + 1;
r = c % 3;
label1.Text = "r=" + r;
if (r >= 1)
{
button3.BackColor = Color.Black;
button4.BackColor = Color.Yellow;
button5.BackColor = Color.Black;
if (r == 2)
{
button3.BackColor = Color.Red;
button4.BackColor = Color.Black;
button5.BackColor = Color.Black;
}
}
else
{
button3.BackColor = Color.Black;
button4.BackColor = Color.Black;
button5.BackColor = Color.Green;
}
}
}
}  

a0930063623 發表在 痞客邦 留言(0) 人氣()

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c;
int d = 1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
button1.Left = 100*c;
if(button1.Left>460)
{
d = -1;
}
if (button1.Left < 0)
{
d = 1;
}
c = c + d;
}
}
}


a0930063623 發表在 痞客邦 留言(0) 人氣()

10665251_949319611751504_3469542894815558548_n  10473364_949319615084837_4574338188718061906_n  


a0930063623 發表在 痞客邦 留言(0) 人氣()

«12