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 ...
随机推荐
- c#部分---好题--顺便练练“类的知识”
练习:判断邮箱格式是否正确 //1.有且只能有一个@ //2.不能以@开头 //3.@之后至少有一个. //4.@和.不能靠在一起 //5.不能以.结尾
- hive权限管理之实践
一.实践心得 主要参考这个连接,里面说得也挺详细的.http://www.aboutyun.com/thread-12549-1-1.html 总结如下: 1.若赋予用户某个表的权限,查用户在该表所属 ...
- dedecms 忘记后台密码
找到admin表 dede_admin,把其pwd的值修改为 默认的 字符串:f297a57a5a743894a0e4, 之后,你的密码就被充值为 admin
- ZOJ-3929 Deque and Balls (DP+找规律)
题目大意:n个数,每个数的大小都在1~n之间.操作n次,第 i 次将第 i 个数放到一个双端队列里面,放到队列两端的概率是相等的.问操作n次之后双端队列中元素满足xi>xi+1的对数的期望,输出 ...
- JS中的自定义属性
<div id="div1" a="a" data-bbb="bbb">div</div> <script&g ...
- ubuntu下nfs服务器的安装与配置
nfs服务器的安装和配置 1.安装nfs 服务器,前提是你的系统能连上网. 2.设置/etc/exports配置文件 (1) 进入/etc/exports配置文件 (2) 在最后一行加入红色那行,/h ...
- eclipse cdt代码悬停窗口背景颜色设置(转载)
在eclipse中编写C++代码时,有一个很方便的功能,是当鼠标停放在某一个函数或变量上不同时,会出现一个悬停框,显示该函数或变量的声明 体.但是, 从Ubuntu 10.04之后,这个悬停框便出现了 ...
- Nginx-limit_req限速配置示例
#以用户二进制IP地址,定义三个漏桶,滴落速率1-3req/sec,桶空间1m,1M能保持大约16000个(IP)状态 limit_req_zone $binary_remote_addr zone= ...
- C#联调C++项目
很多人在编写C#代码时,经常要调用C++代码,有时我们通常用打日志来查看运行状况,这当然可以,不过这样挺不方便,一遍遍的跑代码,一遍遍的看日志,感觉如果可以直接把断点打入C++的代码就好了,其实是可以 ...
- javascript 变量的作用范围
来自: http://hanxin0311.iteye.com/blog/181127 1.根据作用范围不同,变量有全局变量和局部变量两种.在函数里定义的变量为局部变量,局部变量只在函数内有效. 如果 ...