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 Form2 : Form
{
public Form2()
{
InitializeComponent();
}

int x = 0;//记录窗体的原始位置
int y = 0;
private void button1_Click(object sender, EventArgs e)
{
//1、启动
x = this.Left;
y = this.Top;
timer1.Start();
}
//2用i来控制我timer跑到那个点
int i = 0;
int count = 0;
//3、把所有的点定义出来
Point[] ps = { new Point(-10, 0), new Point(-7, -7), new Point(0, -10), new Point(7, -7), new Point(10, 0), new Point(7, 7), new Point(0, 10), new Point(-7, 7) };

private void timer1_Tick(object sender, EventArgs e)
{
//4、将窗体设置为第i个点的位置

this.Left = x + ps[i].X;
this.Top = y + ps[i].Y;
i++;
if (i == 8)
{
i = 0;
count++;

}

if (count == 3)//三圈
{
this.Left = x;//窗体要停止到没有转之前的位置
this.Top = y;
count = 0;
timer1.Stop();//不转了
}

}

private void Form2_Load(object sender, EventArgs e)
{

}

}
}

最新文章

  1. 简述我的SOA服务治理
  2. [更新设计]跨平台物联网通讯框架ServerSuperIO 2.0 ,功能、BUG、细节说明,以及升级思考过程!
  3. 执行mysqld_safe报错:mysqld does not exist or is not executable
  4. android的logcat详细用法
  5. express+gulp构建项目(五)swig模板
  6. AUTOSSH,ssh反向代理
  7. 【OpenCV】opencv3.0中的SVM训练 mnist 手写字体识别
  8. hdu 2004 成绩转换
  9. swift基础--变量
  10. Django ORM 中的批量操作
  11. Strategy 模式
  12. FileSystemWatcher使用方法具体解释
  13. 火狐浏览器,hostadmin hosts文件访问权限不足
  14. maven添加本地jar包依赖
  15. sublime text3编译运行C,Java程序的一些配置
  16. 2017河工大校赛补题CGH and 赛后小结
  17. 解读《德勤2017年全球CIO报告》:顶级CIO的炼成之道
  18. 8位、16位、32位单片机中的“XX位”指什么?
  19. 【NET CORE微服务一条龙应用】应用部署
  20. FastDFS整合nginx后,nginx一直报错

热门文章

  1. ajax中网页传输(二)JSON——下拉列表显示练习
  2. mysql去除重复数据
  3. linux下在eclipse上运行hadoop自带例子wordcount
  4. javax.transaction.xa.XAException: java.sql.SQLException: 无法创建 XA 控制连接。(SQL 2000,SQL2005,SQL2008)
  5. C++11—lambda函数
  6. python 提取图片转为16 24BPP 的方法
  7. python paramiko ssh.exec_command()启动tomcat服务器应用进程失败问题解决方法- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this progr
  8. windows cmd command line 命令
  9. fedora 20 yum出错
  10. 如何为github上的项目添加gif效果图