zoukankan      html  css  js  c++  java
  • 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);

            }

        }
    }

  • 相关阅读:
    PostGIS安装教程
    报错:尝试加载 Oracle 客户端库时引发 BadImageFormatException。如果在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运行,将出现此问题。
    flexpaper跨服务器访问swf不显示问题
    JSAPI 基于arcgis_js_api3.3的部署
    C# datatable排序(转)
    C# 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”
    C# 正则表达式
    AE10.0在Visual Studio 2012下安装没有模板(转)
    AE安装部署以及监测ArcEngine runtime 9.3是否安装
    Flex带CheckBox的Tree(修改ItemRenderer)
  • 原文地址:https://www.cnblogs.com/zhoug2020/p/5875950.html
Copyright © 2011-2022 走看看