2014年12月7日 星期日

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,d=1;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
if (button1.Left > 300 )
d = -1;
if (button1.Left < 50)
d = 1;
c = c + d;
button1.Left = 100*c;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (button1.Left > 300)
d = -1;
if (button1.Left < 50)
d = 1;
c = c + d;
button1.Left = 100 * c;
}
}
}

0 個意見:

張貼留言

訂閱 張貼留言 [Atom]

<< 首頁