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. leetcode 150. Evaluate Reverse Polish Notation ------ java

    Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...

  2. 某种数列问题 (jx.cpp/c/pas) 1000MS 256MB

    众所周知,chenzeyu97有无数的妹子(阿掉!>_<),而且他还有很多恶趣味的问题,继上次纠结于一排妹子的排法以后,今天他有非(chi)常(bao)认(cheng)真(zhe)去研究一 ...

  3. URAL(timus) 1272 Non-Yekaterinburg Subway(最小生成树)

    Non-Yekaterinburg Subway Time limit: 1.0 secondMemory limit: 64 MB A little town started to construc ...

  4. Amazon-countDuplicate

    Print the count of duplicate char in a given string in same order. Ex: Input- 'abbaccdbac', Output- ...

  5. Java设计模式之适配器设计模式

    1.适配器模式( Adapter)定义将一个类的接口转换成客户希望的另外一个接口.Adapter 模式使得原来由于接口不兼容而不能一起工作的 那些类可以一起工作. 现实案例如下:  墙上电源类(22 ...

  6. STL学习小结

    STL就是Standard Template Library,标准模板库.这可能是一个历史上最令人兴奋的工具的最无聊的术语.从根本上说,STL是一些"容器"的集合,这些" ...

  7. luke 操作记录

    精确查询(不需要切分词):得使用KeywordAnalyzer而不是StandardAnalyzer,原因如下: StandardAnalyzer:

  8. QQ登入(2)获取用户信息

    private void initView() { mUserInfo = (TextView) findViewById(R.id.user_info); mUserLogo = (ImageVie ...

  9. java生态环境

    Which Java package do I need? Software Developers: JDK (Java SE Development Kit). For Java Developer ...

  10. Storyboard里面的几种Segue区别及视图的切换:push,modal,popover,replace和custom

    一.视图切换类型介绍 在storyboard中,segue有几种不同的类型,在iphone和ipad的开发中,segue的类型是不同的. 在iphone中,segue有:push,modal,和cus ...