其程式:
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 a = 0,b,c;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
a++;
b=a%130;
if (b <= 65)
{
button1.Left = b * 10;
}
else
{
c = 130 - b;
button1.Left = c * 10;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
a++;
b = a % 130;
if (b <= 65)
{
button1.Left = b * 10;
}
else
{
c = 130 - b;
button1.Left = c * 10;
}
}
}
}
沒有留言:
張貼留言