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的更多相关文章

  1. 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 ...

  2. RSA Study

    These days I study the RSA Algorithm. It is a little complex, but not very. Also, my study has not f ...

  3. Machine Learning Algorithms Study Notes(3)--Learning Theory

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  4. Machine Learning Algorithms Study Notes(2)--Supervised Learning

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  5. Machine Learning Algorithms Study Notes(1)--Introduction

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1    Introduction    1 1.1    ...

  6. 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 ...

  7. 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 ...

  8. A Study of WebRTC Security

    转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...

  9. study topics

    永远不变的东西,原理 study roadmap: 1.user space: tizen power manager => suspend/resume or runtime? android ...

  10. 读书笔记2013第10本:《学得少却考得好Learn More Study Less》

    <学得少却考得好Learn More Study Less>这本书最早是从褪墨网站上看到的,crowncheng翻译了全文.这本书介绍了不少学习方法,非常适合在校的学生,原文的作者Scot ...

随机推荐

  1. Docker网络管理

    一.Docker的四种网络模式(host.container.none.bridge) 1. host模式,使用docker run时使用--net=host指定,docker使用的网络实际上和宿主机 ...

  2. URAL 1291 Gear-wheels(BFS)

    Gear-wheels Time limit: 1.0 secondMemory limit: 64 MB - Arny! What happened with coordinator? Bad wo ...

  3. hdu1827 强连通

    题意:一个人需要联系其他所有人,已知他自己联系每个人的花费,并且他可以联系某个人再让他联系他能联系到的人,给出一系列关系表示 A 能够联系 B.问他最少需要联系多少人,花费多少钱 首先,建成一个有向图 ...

  4. MFC-CString 字符串分割

    CString strSrc = _T("1++2+3+4"); CStringArray strResult; CString strGap = _T("+" ...

  5. Fragment 和 FragmentActivity的使用

    Fragment 和 FragmentActivity的使用 http://blog.csdn.net/izy0001989624/article/details/17072211

  6. 【转】db/dbm

    db,表示一个相对值.当计算A的功率相比于B大或小多少个dB时,可按公式10lg A/B计算.例如:A功率比B功率大一倍,那么10lg A/B = 10 lg 2 = 3dB,也就是说,A的功率比B的 ...

  7. JSBinding + SharpKit / JavaScript 加载流程

    首先,现在的方案是游戏启动就加载全部的 JavaScript 代码. 先看下 StreamingAssets/JavaScript/ 文件夹下的目录结构:

  8. JS的Document属性和方法小结

    Document想必大家并不陌生吧,在使用js的过程中会经常遇到它,那么它有哪些属性.哪些方法,在本文将以示例为大家详细介绍下,希望对大家有所帮助 document.title //设置文档标题等价于 ...

  9. Python学习笔记——文件

    1.文件只是连续的字节序列 open()内建函数是打开文件之门的钥匙 file_obj=open(file_name,access_mode='r/w/a,' buffering=-1) file_n ...

  10. qemu-kvm命令

    三种方式创建虚拟机 1.qemu-kvm来创建虚拟机 通过阅读man qemu-kvm手册而清楚的. 于20160430阅读 [root@kvm1 ~]# /usr/libexec/qemu-kvm ...