C# STUDY
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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
public delegate void TimerHandler();
public event TimerHandler m_TimerEvent;
public int m_offset;
private System.Timers.Timer m_timer;
private List<System.Drawing.Point> m_orinLocation;
private List<System.Windows.Forms.Button> m_Buttons;
public Form1()
{
InitializeComponent();
m_timer = new System.Timers.Timer(50);
m_timer.Elapsed += new System.Timers.ElapsedEventHandler(theout);
m_timer.Enabled = true;
m_orinLocation = new List<System.Drawing.Point>();
m_Buttons = new List<System.Windows.Forms.Button>();
m_orinLocation.Add(button1.Location);
m_orinLocation.Add(button2.Location);
m_orinLocation.Add(button3.Location);
m_orinLocation.Add(button4.Location);
m_orinLocation.Add(button5.Location);
m_orinLocation.Add(button6.Location);
m_orinLocation.Add(button7.Location);
m_orinLocation.Add(button8.Location);
m_orinLocation.Add(button9.Location);
m_Buttons.Add(button1);
m_Buttons.Add(button2);
m_Buttons.Add(button3);
m_Buttons.Add(button4);
m_Buttons.Add(button5);
m_Buttons.Add(button6);
m_Buttons.Add(button7);
m_Buttons.Add(button8);
m_Buttons.Add(button9);
m_offset = 0;
m_TimerEvent += process;
}
public void process()
{
m_timer.Enabled = false;
int itemHeight = this.button1.Height;
System.Console.WriteLine("Process m_offset{0}, mod{1}", m_offset, m_offset % itemHeight);
m_offset += itemHeight / 2;
if (m_offset >= itemHeight)
{
m_offset = 0;
for (int i = 0; i < 9; ++i)
{
m_Buttons[i].Location = new System.Drawing.Point(m_orinLocation[i].X, m_orinLocation[i].Y);
}
}
else
{
for (int i = 0; i < 9; ++i)
{
m_Buttons[i].Location = new System.Drawing.Point(m_orinLocation[i].X, m_orinLocation[i].Y - m_offset);
}
}
m_timer.Enabled = true;
}
public void theout(object source, System.Timers.ElapsedEventArgs e)
{
try
{
if (m_TimerEvent != null)
this.Invoke(m_TimerEvent);
}
catch(System.Exception err)
{
Console.WriteLine("{0}",err.Message);
}
}
private void button10_Click(object sender, EventArgs e)
{
}
protected override void OnClosing(CancelEventArgs e)
{
m_timer.Stop();
m_timer.Close();
m_TimerEvent = null;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
}
}
C# STUDY的更多相关文章
- Improve Your Study Habits
1.Plan your time carefully. Make a list of your weekly tasks.Then make a schedule or chart of your t ...
- RSA Study
These days I study the RSA Algorithm. It is a little complex, but not very. Also, my study has not f ...
- Machine Learning Algorithms Study Notes(3)--Learning Theory
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(1)--Introduction
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1 Introduction 1 1.1 ...
- jar tvf study.war jar命令查看war/jar包的内容
jar tvf study.war 0 Thu Oct 20 14:01:18 CST 2016 META-INF/ 137 Thu Oct 20 14:01:16 CST 2016 META-INF ...
- Mongo DB Study: first face with mongo DB
Mongo DB Study: first face with mongo DB 1. study methods: 1. Translate: I am the mongo DB organiz ...
- A Study of WebRTC Security
转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...
- study topics
永远不变的东西,原理 study roadmap: 1.user space: tizen power manager => suspend/resume or runtime? android ...
- 读书笔记2013第10本:《学得少却考得好Learn More Study Less》
<学得少却考得好Learn More Study Less>这本书最早是从褪墨网站上看到的,crowncheng翻译了全文.这本书介绍了不少学习方法,非常适合在校的学生,原文的作者Scot ...
随机推荐
- HTML DOM部分---事件 windows对象;
<!--DOM操作windows对象操作 对浏览器进行操作document对象操作 对浏览器内页面文件进行操作 window.shuxing;属性调用格式window.fangfa();方法调用 ...
- Java——多线程安全问题
静态代码块中没有this /* * 线程安全问题产生的原因: * 1.多个线程操作共享的数据 * 2.操作共享数据的线程代码有多条 * * 当一个线程在执行操作共享数据的多条代码过程中,其他线程 ...
- Unity摄像机
把相机做为人物的子对象,就可以制作: 1.第1人称摄像机:把摄像机摆在眼睛前面 2.第3人称摄像机:把摄像机摆在人后上面 Clear Flags: http://www.haogongju.net/a ...
- css float对于之后布局的影响
后面的元素不浮动,即便设置了宽度,表面上只占了一定的宽度,但实际上占了全屏.(所以设置了overflow之后,并且之后的div设置了宽度,再设置margin-left可能不起作用). 高度对浮动的影响 ...
- 使用swiper和吸顶效果代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- 使用Ef时,对一个或多个实体的验证失败。有关详细信息,请参见“EntityValidationErrors”属性。
EntityValidationErrors 关于如何查看 EntityValidationErrors 详细信息的解决方法 我们在 EF 的编程中,有时候会遇到这样一个错误: 但是,按照他的提示 ...
- @Resource注解
原文地址:http://blog.sina.com.cn/s/blog_a795a96f01016if1.html @Resource 注解被用来激活一个命名资源(named resource)的 ...
- 树莓派 2 win 10 IOT
Setting up Windows 10 for IoT on your Raspberry Pi This week at the BUILD conference in San Francisc ...
- 【转】PHP error_reporting() 错误控制函数功能详解
定义和用法: error_reporting() 设置 PHP 的报错级别并返回当前级别. 函数语法: error_reporting(report_level) 如果参数 level 未指定 ...
- C# 开发BHO插件
BHO(Browser Helper Object)是插件,它寄存在IE浏览器中运行.在咱们的日常生活中无时无刻都在使用BHO,比如:迅雷检测用户是否单击了下载链接的BHO.用BHO也能做出些非常有意 ...