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 按钮移动
{
public partial class Form1 : Form
{
Boolean flag=true;
public Form1()
{
InitializeComponent();
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (button1.Location.Y < 120 && flag ==true )
{
button1.Location = new System.Drawing.Point(button1.Location.X, button1.Location.Y + 3);
}
else
{
flag = false;
}
if (flag == false && button1.Location.Y > 50)
{
button1.Location = new System.Drawing.Point(button1.Location.X, button1.Location.Y - 3);
}
}
}
}
C#按钮移动
最新推荐文章于 2022-05-04 11:56:53 发布