• C#实现四部电梯的调度


    电梯调度

       初次进行结对开发,一开始也不知道怎么设计规划我们的作业。也不知道怎么更好的配合去完成任务,通过几天的磨合,我们对结对开发有了更深刻的理解,作业进程也慢慢加快,感觉俩人配合对彼此的帮助都挺大的,下面我们就介绍一下我们这次作业的具体思路和大致分工和流程:

       3月11号: 我们首先确定了这次作业用c#编写窗体应用程序来实现对四部电梯的调度。下午我俩去了图书馆借了关于c#的资料进行学习。

       3月12号下午 通过上网查阅相关的资料和与同学们的交流,我们大体有了一个实现电梯调度的概念以及需要用到的相关知识,同时我们进行了分工,刘三龙负责电梯调度页面的设计,严晓雄查看资料学习页面设计所用到的一些组件的编程方法;

       313号:我们一起看了设计出来的运行界面,感觉界面太大,form窗体有点不够用,界面也不够直观易看懂,经过一起讨论和设计,我们调整了页面布局,同时也使页面比以前更易看明白。

       315号:我们开始了电梯调度的编程,程序的思路在下面介绍,第一天我们在创建的电梯调度的类里面写下了程序的大体框架

       317号下午我们依据写好的程序框架开始了具体的编程,一下午我们一边编写程序一边讨论程序的逻辑问题以及算法的合理问题

       318号下午:我们继续上次的编程,不过这次出现了许多错误,编好一部电梯的程序运行时,程序虽然没有语法错误,但运行的结果非常不理想,电梯的运动方向总是和我们预想的不一样,还有程序的响应次序也不对,这另我们非常着急,看半天程序也不知道哪儿出错,经过查资料和讨论,我们渐渐找出了问题所在,完善了程序,运行结果也基本满意

       319号:我们根据昨天编写程序的思路,依葫芦画瓢,完成了其他三部的程序。

       3月21号:编写博客!

    组员:刘三龙、严晓雄

    程序思想:

         首先我们设计了每个楼层外部的上下按钮,在每个buttom按钮里编写一个click事件将此层数的信息赋值给panel控件里的text显示控件,显示电梯要去的层数以及运动的方向,其次就是电梯内部的按钮,同样编写click事件,进行信息传送。然后设置一个panel控件在里面在设置一个picturebox控件将其底色设置为蓝色,通过for循环不断改变picturebox控件的坐标实现模仿电梯运动的效果。然后再设置一个panel控件在其上面再对称放俩个panel控件,用来显示电梯门的打开和关闭,通过电梯到达目的层来唤醒电梯开门事件,同样通过for循环不断改变俩控件坐标来实现电梯的打开和关闭。

    程序代码:

     

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace Elecator
    {
        public partial class Form1 : Form
        {
            private Image myImage2;
            private Image myImage3;
            int NumFloor = 1;
            int isDoorOpen = 0;//0为关门,1为开门
            public static liftC l = new liftC();
           // public control c = new control();
            public const int n = 23;
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                myImage2 = new Bitmap(panel1.Width, panel1.Height);//电梯运动
                myImage3 = new Bitmap(panel6.Width, panel6.Height);
            }
    
            public void manage()
            {
                //int[] stack = new Array();
    
            }
    
            protected override void OnPaint(PaintEventArgs e)
            {
                //DrawLine();
                base.OnPaint(e);
            }
    
            private void textBox1_TextChanged(object sender, EventArgs e)
            {
    
            }
    
            private void panel1_Paint(object sender, PaintEventArgs e)
            {
    
            }
            public int getfloorLength()
            {
                return panel1.Height - l.Num * n;
            }
    
            private void pictureBox1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void button1Up_Click(object sender, EventArgs e)
            {
                string s1 = button2Up.Name;
                btnAction(s1);
            }
    
            private void button20Up_Click(object sender, EventArgs e)
            {
                string s1 = button20Up.Name;
                btnAction(s1);
            }
    
            private void button1Down_Click(object sender, EventArgs e)
            {
                string s1 = button2Down.Name;
                btnAction(s1);
            }
    
            private void buttonUp_Click(object sender, EventArgs e)
            {
                string s1 = button2Up.Name;
                btnAction(s1);
            }
    
            private void button2Down_Click(object sender, EventArgs e)
            {
                string s1 = button3Down.Name;
                btnAction(s1);
            }
    
            private void button1Down_Click_1(object sender, EventArgs e)
            {
                string s1 = button2Down.Name;
                btnAction(s1);
            }
    
            private void button0Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button1Up.Name;
                btnAction(s1);
            }
    
            public void btnAction(string s1)
            {
                if (getFloor(s1) < l.Num)
                {
                    lbldown.ForeColor = Color.Red;
                    lbDown.ForeColor = Color.Red;
                }
                else if (getFloor(s1) > l.Num)
                {
                    lblup.ForeColor = Color.Red;
                    lbUp.ForeColor = Color.Red;
                }
                l.Num = getFloor(s1);
                lbNum.Text = (l.Num-1).ToString();
                lbFloorNum.Text = (l.Num-1).ToString();
                move.Interval = 1000;
                move.Start();
            }
    
            private void doorLeft_Paint(object sender, PaintEventArgs e)
            {
    
            }
    
            public int getFloor(string letter)
            {
                string s1 = letter;
                string str = "";
                foreach (char s in s1)
                {
                    if (s <= 58 && s >= 48)
                    {
                        str += s;
                    }
                }
                return int.Parse(str);
            }
    
            private void openDoor_Tick(object sender, EventArgs e)
            {
                for (int bdx = 78; bdx >= 1; bdx--)
                {
                    doorLeft.Width = bdx;
                    doorRight.Width = bdx;
                    doorRight.Location = new Point(80 + 79 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                openDoor.Stop();
    
            }
    
            private void closeDoor_Tick(object sender, EventArgs e)
            {
                for (int bdx = 0; bdx <= 79; bdx++)
                {
                    doorLeft.Width = bdx;
                    doorRight.Width = bdx;
                    doorRight.Location = new Point(159 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                closeDoor.Stop();
            }
    
            private void lblup_Click(object sender, EventArgs e)
            {
    
            }
    
            private void panel4_Paint(object sender, PaintEventArgs e)
            {
    
            }
    
            private void groupBox1_Enter(object sender, EventArgs e)
            {
    
            }
    
            private void button3Up_Click(object sender, EventArgs e)
            {
                string s1 = button4Up.Name;
                btnAction(s1);
            }
    
            private void button4Down_Click(object sender, EventArgs e)
            {
                string s1 = button4Down.Name;
                btnAction(s1);
            }
    
            private void button2Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button2Up.Name;
                btnAction(s1);
            }
    
            private void button2Down_Click_2(object sender, EventArgs e)
            {
                string s1 = button2Down.Name;
                btnAction(s1);
            }
    
            private void button62_Click(object sender, EventArgs e)
            {
                openDoor.Interval = 500;
                openDoor.Start();
                this.Focus();
            }
    
            private void button63_Click(object sender, EventArgs e)
            {
                closeDoor.Interval = 500;
                closeDoor.Start();
                this.Focus();
            }
    
    
            private void but3_Click(object sender, EventArgs e)
            {
                string s1 = but3.Name;
                btnAction(s1);
            }
    
    
            private void button2Up_Click(object sender, EventArgs e)
            {
                string s1 = button2Up.Name;
                btnAction(s1);
            }
    
            private void move_Tick(object sender, EventArgs e)
            {
                if (NumFloor < l.Num)
                {
                    lblup.ForeColor = Color.Red;
                    for (int i = panel1.Height - NumFloor * n; i >= getfloorLength(); i--)
                    {
                        lift.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                else
                {
                    lbldown.ForeColor = Color.Red;
                    for (int i = panel1.Height - NumFloor * n; i <= getfloorLength(); i++)
                    {
                        //DrawLine();
                        lift.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                //DrawLine();
                openDoor.Interval = 500;
                openDoor.Start();
                this.Focus();
    
                System.Threading.Thread.CurrentThread.Join(1000);
    
                NumFloor = l.Num;
                lblup.ForeColor = Color.DimGray;
                lbldown.ForeColor = Color.DimGray;
    
                lbUp.ForeColor = Color.DimGray;
                lbDown.ForeColor = Color.DimGray;
    
                closeDoor.Interval = 500;
                closeDoor.Start();
                this.Focus();
                move.Stop();
            }
    
            private void button1Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button1Up.Name;
                btnAction(s1);
                lbNum.Text = "-1";
                lbFloorNum.Text = "-1";
            }
    
            private void button3Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button3Up.Name;
                btnAction(s1);
            }
    
            private void button4Up_Click(object sender, EventArgs e)
            {
                string s1 = button4Up.Name;
                btnAction(s1);
            }
    
            private void button3Down_Click(object sender, EventArgs e)
            {
                string s1 = button3Down.Name;
                btnAction(s1);
            }
    
    
            private void but1_Click(object sender, EventArgs e)
            {
                string s1 = but1.Name;
                btnAction(s1);
                lbNum.Text = "-1";
                lbFloorNum.Text ="-1";
            }
    
            private void but5_Click(object sender, EventArgs e)
            {
                string s1 = but5.Name;
                btnAction(s1);
            }
    
            private void but6_Click(object sender, EventArgs e)
            {
                string s1 = but6.Name;
                btnAction(s1);
            }
    
            private void but4_Click(object sender, EventArgs e)
            {
                string s1 = but4.Name;
                btnAction(s1);
            }
    
            private void button4Down_Click_1(object sender, EventArgs e)
            {
                string s1 = button4Down.Name;
                btnAction(s1);
            }
    
            private void but2_Click(object sender, EventArgs e)
            {
                string s1 = but2.Name;
                btnAction(s1);
            }
    
            private void but3_Click_1(object sender, EventArgs e)
            {
                string s1 = but3.Name;
                btnAction(s1);
            }
    
            private void but7_Click(object sender, EventArgs e)
            {
                string s1 = but7.Name;
                btnAction(s1);
            }
    
            private void but8_Click(object sender, EventArgs e)
            {
                string s1 = but8.Name;
                btnAction(s1);
            }
    
            private void but9_Click(object sender, EventArgs e)
            {
                string s1 = but9.Name;
                btnAction(s1);
            }
    
            private void but10_Click(object sender, EventArgs e)
            {
                string s1 = but10.Name;
                btnAction(s1);
            }
    
            private void but11_Click(object sender, EventArgs e)
            {
                string s1 = but11.Name;
                btnAction(s1);
            }
    
            private void but12_Click(object sender, EventArgs e)
            {
                string s1 = but12.Name;
                btnAction(s1);
            }
    
            private void but13_Click(object sender, EventArgs e)
            {
                string s1 = but13.Name;
                btnAction(s1);
            }
    
            private void but14_Click(object sender, EventArgs e)
            {
                string s1 = but14.Name;
                btnAction(s1);
            }
    
            private void but15_Click(object sender, EventArgs e)
            {
                string s1 = but15.Name;
                btnAction(s1);
            }
    
            private void but16_Click(object sender, EventArgs e)
            {
                string s1 = but16.Name;
                btnAction(s1);
            }
    
            private void but17_Click(object sender, EventArgs e)
            {
                string s1 = but17.Name;
                btnAction(s1);
            }
    
            private void but18_Click(object sender, EventArgs e)
            {
                string s1 = but18.Name;
                btnAction(s1);
            }
    
            private void but19_Click(object sender, EventArgs e)
            {
                string s1 = but19.Name;
                btnAction(s1);
            }
    
            private void but20_Click(object sender, EventArgs e)
            {
                string s1 = but20.Name;
                btnAction(s1);
            }
    
            private void but21_Click(object sender, EventArgs e)
            {
                string s1 = but21.Name;
                btnAction(s1);
            }
    
            private void button5Down_Click(object sender, EventArgs e)
            {
                string s1 = button5Down.Name;
                btnAction(s1);
            }
    
            private void button6Down_Click(object sender, EventArgs e)
            {
                string s1 = button6Down.Name;
                btnAction(s1);
            }
    
            private void button7Down_Click(object sender, EventArgs e)
            {
                string s1 = button7Down.Name;
                btnAction(s1);
            }
    
            private void button8Down_Click(object sender, EventArgs e)
            {
                string s1 = button8Down.Name;
                btnAction(s1);
            }
    
            private void button9Down_Click(object sender, EventArgs e)
            {
                string s1 = button9Down.Name;
                btnAction(s1);
            }
    
            private void button10Down_Click(object sender, EventArgs e)
            {
                string s1 = button10Down.Name;
                btnAction(s1);
            }
    
            private void button11Down_Click(object sender, EventArgs e)
            {
                string s1 = button11Down.Name;
                btnAction(s1);
            }
    
            private void button12Down_Click(object sender, EventArgs e)
            {
                string s1 = button12Down.Name;
                btnAction(s1);
            }
    
            private void button13Down_Click(object sender, EventArgs e)
            {
                string s1 = button13Down.Name;
                btnAction(s1);
            }
    
            private void button14Down_Click(object sender, EventArgs e)
            {
                string s1 = button14Down.Name;
                btnAction(s1);
            }
    
            private void button15Down_Click(object sender, EventArgs e)
            {
                string s1 = button15Down.Name;
                btnAction(s1);
            }
    
            private void button16Down_Click(object sender, EventArgs e)
            {
                string s1 = button16Down.Name;
                btnAction(s1);
            }
    
            private void button17Down_Click(object sender, EventArgs e)
            {
                string s1 = button17Down.Name;
                btnAction(s1);
            }
    
            private void button18Down_Click(object sender, EventArgs e)
            {
                string s1 = button18Down.Name;
                btnAction(s1);
            }
    
            private void button19Down_Click(object sender, EventArgs e)
            {
                string s1 = button19Down.Name;
                btnAction(s1);
            }
    
            private void button20Down_Click(object sender, EventArgs e)
            {
                string s1 = button20Down.Name;
                btnAction(s1);
            }
    
            private void button21Down_Click(object sender, EventArgs e)
            {
                string s1 = button21Down.Name;
                btnAction(s1);
            }
    
            private void button18Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button18Up.Name;
                btnAction(s1);
            }
    
            private void button9Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button9Up.Name;
                btnAction(s1);
            }
    
            private void button10Up_Click_1(object sender, EventArgs e)
            {
                string s1 = button10Up.Name;
                btnAction(s1);
            }
    
            private void button6Up_Click(object sender, EventArgs e)
            {
                string s1 = button6Up.Name;
                btnAction(s1);
            }
    
            private void button7Up_Click(object sender, EventArgs e)
            {
                string s1 = button7Up.Name;
                btnAction(s1);
            }
    
            private void button8Up_Click(object sender, EventArgs e)
            {
                string s1 = button8Up.Name;
                btnAction(s1);
            }
    
            private void button11Up_Click(object sender, EventArgs e)
            {
                string s1 = button11Up.Name;
                btnAction(s1);
            }
    
            private void button12Up_Click(object sender, EventArgs e)
            {
                string s1 = button12Up.Name;
                btnAction(s1);
            }
    
            private void button13Up_Click(object sender, EventArgs e)
            {
                string s1 = button13Up.Name;
                btnAction(s1);
            }
    
            private void button14Up_Click(object sender, EventArgs e)
            {
                string s1 = button14Up.Name;
                btnAction(s1);
            }
    
            private void button15Up_Click(object sender, EventArgs e)
            {
                string s1 = button15Up.Name;
                btnAction(s1);
            }
    
            private void button16Up_Click(object sender, EventArgs e)
            {
                string s1 = button16Up.Name;
                btnAction(s1);
            }
    
            private void button17Up_Click(object sender, EventArgs e)
            {
                string s1 = button17Up.Name;
                btnAction(s1);
            }
    
            private void button19Up_Click(object sender, EventArgs e)
            {
                string s1 = button19Up.Name;
                btnAction(s1);
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
    
            }
    
            private void lbldown_Click(object sender, EventArgs e)
            {
    
            }
    
            public void btnAction1(string s1)
            {
                if (getFloor(s1) < l.Num)
                {
                    lbldown1.ForeColor = Color.Red;
                    lbDown1.ForeColor = Color.Red;
                }
                else if (getFloor(s1) > l.Num)
                {
                    lblup1.ForeColor = Color.Red;
                    lbUp1.ForeColor = Color.Red;
                }
                l.Num = getFloor(s1);
                lbNum1.Text = (l.Num - 1).ToString();
                lbFloorNum1.Text = (l.Num - 1).ToString();
                move1.Interval = 1000;
                move1.Start();
            }
    
            public void btnAction2(string s1)
            {
                if (getFloor(s1) < l.Num)
                {
                    lbldown2.ForeColor = Color.Red;
                    lbDown2.ForeColor = Color.Red;
                }
                else if (getFloor(s1) > l.Num)
                {
                    lblup2.ForeColor = Color.Red;
                    lbUp2.ForeColor = Color.Red;
                }
                l.Num = getFloor(s1);
                lbNum2.Text = (l.Num - 1).ToString();
                lbFloorNum2.Text = (l.Num - 1).ToString();
                move.Interval = 1000;
                move2.Start();
            }
    
            public void btnAction3(string s1)
            {
                if (getFloor(s1) < l.Num)
                {
                    lbldown3.ForeColor = Color.Red;
                    lbDown3.ForeColor = Color.Red;
                }
                else if (getFloor(s1) > l.Num)
                {
                    lblup3.ForeColor = Color.Red;
                    lbUp3.ForeColor = Color.Red;
                }
                l.Num = getFloor(s1);
                lbNum3.Text = (l.Num - 1).ToString();
                lbFloorNum3.Text = (l.Num - 1).ToString();
                move.Interval = 1000;
                move3.Start();
            }
    
            private void move1_Tick(object sender, EventArgs e)
            {
                if (NumFloor < l.Num)
                {
                    lblup1.ForeColor = Color.Red;
                    for (int i = panel6.Height - NumFloor * n; i >= getfloorLength(); i--)
                    {
                        lift1.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                else
                {
                    lbldown1.ForeColor = Color.Red;
                    for (int i = panel6.Height - NumFloor * n; i <= getfloorLength(); i++)
                    {
                        lift1.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                openDoor1.Interval = 500;
                openDoor1.Start();
                this.Focus();
    
                System.Threading.Thread.CurrentThread.Join(1000);
    
                NumFloor = l.Num;
                lblup1.ForeColor = Color.DimGray;
                lbldown1.ForeColor = Color.DimGray;
    
                lbUp1.ForeColor = Color.DimGray;
                lbDown1.ForeColor = Color.DimGray;
    
                closeDoor1.Interval = 500;
                closeDoor1.Start();
                this.Focus();
                move1.Stop();
            }
    
            private void butn1_Click(object sender, EventArgs e)
            {
                string s1 = butn1.Name;
                btnAction1(s1);
                lbNum1.Text = "-1";
                lbFloorNum1.Text = "-1";
            }
    
            private void button2Up_Click_2(object sender, EventArgs e)
            {
                string s1 = button2Up.Name;
                btnAction(s1);
            }
    
            private void button2Down_Click_1(object sender, EventArgs e)
            {
                string s1 = button2Down.Name;
                btnAction(s1);
            }
    
            private void but2up_Click(object sender, EventArgs e)
            {
                string s1 = but2up.Name;
                btnAction1(s1);
            }
    
            private void but3up_Click(object sender, EventArgs e)
            {
                string s1 = but3up.Name;
                btnAction1(s1);
            }
    
            private void but4up_Click(object sender, EventArgs e)
            {
                string s1 = but4up.Name;
                btnAction1(s1);
            }
    
            private void but5up_Click(object sender, EventArgs e)
            {
                string s1 = but5up.Name;
                btnAction1(s1);
            }
    
            private void but6up_Click(object sender, EventArgs e)
            {
                string s1 = but6up.Name;
                btnAction1(s1);
            }
    
            private void openDoor1_Tick(object sender, EventArgs e)
            {
                for (int bdx = 78; bdx >= 1; bdx--)
                {
    
                    doorLeft1.Width = bdx;
                    doorRight1.Width = bdx;
                    doorRight1.Location = new Point(80 + 79 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                openDoor1.Stop();
            }
    
            private void closeDoor1_Tick(object sender, EventArgs e)
            {
                for (int bdx = 0; bdx <= 79; bdx++)
                {
                    doorLeft1.Width = bdx;
                    doorRight1.Width = bdx;
                    doorRight1.Location = new Point(159 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                closeDoor1.Stop();
            }
    
            private void but7up_Click(object sender, EventArgs e)
            {
                string s1 = but7up.Name;
                btnAction1(s1);
            }
    
            private void but8up_Click(object sender, EventArgs e)
            {
                string s1 = but8up.Name;
                btnAction1(s1);
            }
    
            private void but9up_Click(object sender, EventArgs e)
            {
                string s1 = but9up.Name;
                btnAction1(s1);
            }
    
            private void but10up_Click(object sender, EventArgs e)
            {
                string s1 = but10up.Name;
                btnAction1(s1);
            }
    
            private void but11up_Click(object sender, EventArgs e)
            {
                string s1 = but11up.Name;
                btnAction1(s1);
            }
    
            private void but12up_Click(object sender, EventArgs e)
            {
                string s1 = but12up.Name;
                btnAction1(s1);
            }
    
            private void but13up_Click(object sender, EventArgs e)
            {
                string s1 = but13up.Name;
                btnAction1(s1);
            }
    
            private void but14up_Click(object sender, EventArgs e)
            {
                string s1 = but14up.Name;
                btnAction1(s1);
            }
    
            private void but15up_Click(object sender, EventArgs e)
            {
                string s1 = but15up.Name;
                btnAction1(s1);
            }
    
            private void but16up_Click(object sender, EventArgs e)
            {
                string s1 = but16up.Name;
                btnAction1(s1);
            }
    
            private void but17up_Click(object sender, EventArgs e)
            {
                string s1 = but17up.Name;
                btnAction1(s1);
            }
    
            private void but18up_Click(object sender, EventArgs e)
            {
                string s1 = but18up.Name;
                btnAction1(s1);
            }
    
            private void but19up_Click(object sender, EventArgs e)
            {
                string s1 = but19up.Name;
                btnAction1(s1);
            }
    
            private void but20up_Click(object sender, EventArgs e)
            {
                string s1 = but20up.Name;
                btnAction1(s1);
            }
    
            private void but21down_Click(object sender, EventArgs e)
            {
                string s1 = but21down.Name;
                btnAction1(s1);
            }
    
            private void but20down_Click(object sender, EventArgs e)
            {
                string s1 = but20down.Name;
                btnAction1(s1);
            }
    
            private void but19down_Click(object sender, EventArgs e)
            {
                string s1 = but19down.Name;
                btnAction1(s1);
            }
    
            private void but18down_Click(object sender, EventArgs e)
            {
                string s1 = but18down.Name;
                btnAction1(s1);
            }
    
            private void but17down_Click(object sender, EventArgs e)
            {
                string s1 = but17down.Name;
                btnAction1(s1);
            }
    
            private void but16down_Click(object sender, EventArgs e)
            {
                string s1 = but16down.Name;
                btnAction1(s1);
            }
    
            private void but15down_Click(object sender, EventArgs e)
            {
                string s1 = but15down.Name;
                btnAction1(s1);
            }
    
            private void but14down_Click(object sender, EventArgs e)
            {
                string s1 = but14down.Name;
                btnAction1(s1);
            }
    
            private void but13down_Click(object sender, EventArgs e)
            {
                string s1 = but13down.Name;
                btnAction1(s1);
            }
    
            private void but12down_Click(object sender, EventArgs e)
            {
                string s1 = but12down.Name;
                btnAction1(s1);
            }
    
            private void but11down_Click(object sender, EventArgs e)
            {
                string s1 = but11down.Name;
                btnAction1(s1);
            }
    
            private void but10down_Click(object sender, EventArgs e)
            {
                string s1 = but10down.Name;
                btnAction1(s1);
            }
    
            private void but9down_Click(object sender, EventArgs e)
            {
                string s1 = but9down.Name;
                btnAction1(s1);
            }
    
            private void but8down_Click(object sender, EventArgs e)
            {
                string s1 = but8down.Name;
                btnAction1(s1);
            }
    
            private void but7down_Click(object sender, EventArgs e)
            {
                string s1 = but7down.Name;
                btnAction1(s1);
            }
    
            private void but6down_Click(object sender, EventArgs e)
            {
                string s1 = but6down.Name;
                btnAction1(s1);
            }
    
            private void but5down_Click(object sender, EventArgs e)
            {
                string s1 = but5down.Name;
                btnAction1(s1);
            }
    
            private void but4down_Click(object sender, EventArgs e)
            {
                string s1 = but4down.Name;
                btnAction1(s1);
            }
    
            private void but3down_Click(object sender, EventArgs e)
            {
                string s1 = but3down.Name;
                btnAction1(s1);
            }
    
            private void but2down_Click(object sender, EventArgs e)
            {
                string s1 = but2down.Name;
                btnAction1(s1);
            }
    
            private void buta1_Click(object sender, EventArgs e)
            {
                string s1 = buta1.Name;
                btnAction1(s1);
                lbNum1.Text = "-1";
                lbFloorNum1.Text = "-1";
            }
    
            private void buta2_Click(object sender, EventArgs e)
            {
                string s1 = but2.Name;
                btnAction1(s1);
            }
    
            private void buta3_Click(object sender, EventArgs e)
            {
                string s1 = but3.Name;
                btnAction1(s1);
            }
    
            private void buta4_Click(object sender, EventArgs e)
            {
                string s1 = but4.Name;
                btnAction1(s1);
            }
    
            private void buta5_Click(object sender, EventArgs e)
            {
                string s1 = but5.Name;
                btnAction1(s1);
            }
    
            private void buta6_Click(object sender, EventArgs e)
            {
                string s1 = but6.Name;
                btnAction1(s1);
            }
    
            private void buta7_Click(object sender, EventArgs e)
            {
                string s1 = but7.Name;
                btnAction1(s1);
            }
    
            private void buta8_Click(object sender, EventArgs e)
            {
                string s1 = but8.Name;
                btnAction1(s1);
            }
    
            private void buta9_Click(object sender, EventArgs e)
            {
                string s1 = but9.Name;
                btnAction1(s1);
            }
    
            private void buta10_Click(object sender, EventArgs e)
            {
                string s1 = but10.Name;
                btnAction1(s1);
            }
    
            private void buta11_Click(object sender, EventArgs e)
            {
                string s1 = but11.Name;
                btnAction1(s1);
            }
    
            private void buta12_Click(object sender, EventArgs e)
            {
                string s1 = but12.Name;
                btnAction1(s1);
            }
    
            private void buta13_Click(object sender, EventArgs e)
            {
                string s1 = but13.Name;
                btnAction1(s1);
            }
    
            private void buta14_Click(object sender, EventArgs e)
            {
                string s1 = but14.Name;
                btnAction1(s1);
            }
    
            private void buta15_Click(object sender, EventArgs e)
            {
                string s1 = but15.Name;
                btnAction1(s1);
            }
    
            private void buta16_Click(object sender, EventArgs e)
            {
                string s1 = but16.Name;
                btnAction1(s1);
            }
    
            private void buta17_Click(object sender, EventArgs e)
            {
                string s1 = but17.Name;
                btnAction1(s1);
            }
    
            private void buta18_Click(object sender, EventArgs e)
            {
                string s1 = but18.Name;
                btnAction1(s1);
            }
    
            private void buta19_Click(object sender, EventArgs e)
            {
                string s1 = but19.Name;
                btnAction1(s1);
            }
    
            private void buta20_Click(object sender, EventArgs e)
            {
                string s1 = but20.Name;
                btnAction1(s1);
            }
    
            private void buta21_Click(object sender, EventArgs e)
            {
                string s1 = but21.Name;
                btnAction1(s1);
            }
    
            private void button124_Click(object sender, EventArgs e)
            {
                openDoor1.Interval = 500;
                openDoor1.Start();
                this.Focus();
            }
    
            private void button123_Click(object sender, EventArgs e)
            {
                closeDoor1.Interval = 500;
                closeDoor1.Start();
                this.Focus();
            }
    
            private void butb1_Click(object sender, EventArgs e)
            {
                string s1 = butb1.Name;
                btnAction2(s1);
                lbNum2.Text = "-1";
                lbFloorNum2.Text = "-1";
            }
    
            private void butb2_Click(object sender, EventArgs e)
            {
                string s1 = butb2.Name;
                btnAction2(s1);
            }
    
            private void butb3_Click(object sender, EventArgs e)
            {
                string s1 = butb3.Name;
                btnAction2(s1);
            }
    
            private void butb4_Click(object sender, EventArgs e)
            {
                string s1 = butb4.Name;
                btnAction2(s1);
            }
    
            private void butb5_Click(object sender, EventArgs e)
            {
                string s1 = butb5.Name;
                btnAction2(s1);
            }
    
            private void butb6_Click(object sender, EventArgs e)
            {
                string s1 = butb6.Name;
                btnAction2(s1);
            }
    
            private void butb7_Click(object sender, EventArgs e)
            {
                string s1 = butb7.Name;
                btnAction2(s1);
            }
    
            private void butb8_Click(object sender, EventArgs e)
            {
                string s1 = butb8.Name;
                btnAction2(s1);
            }
    
            private void butb9_Click(object sender, EventArgs e)
            {
                string s1 = butb9.Name;
                btnAction2(s1);
            }
    
            private void butb10_Click(object sender, EventArgs e)
            {
                string s1 = butb10.Name;
                btnAction2(s1);
            }
    
            private void butb11_Click(object sender, EventArgs e)
            {
                string s1 = butb11.Name;
                btnAction2(s1);
            }
    
            private void butb12_Click(object sender, EventArgs e)
            {
                string s1 = butb12.Name;
                btnAction2(s1);
            }
    
            private void butb13_Click(object sender, EventArgs e)
            {
                string s1 = butb13.Name;
                btnAction2(s1);
            }
    
            private void butb14_Click(object sender, EventArgs e)
            {
                string s1 = butb14.Name;
                btnAction2(s1);
            }
    
            private void butb15_Click(object sender, EventArgs e)
            {
                string s1 = butb15.Name;
                btnAction2(s1);
            }
    
            private void butb16_Click(object sender, EventArgs e)
            {
                string s1 = butb16.Name;
                btnAction2(s1);
            }
    
            private void butb17_Click(object sender, EventArgs e)
            {
                string s1 = butb17.Name;
                btnAction2(s1);
            }
    
            private void butb18_Click(object sender, EventArgs e)
            {
                string s1 = butb18.Name;
                btnAction2(s1);
            }
    
            private void butb19_Click(object sender, EventArgs e)
            {
                string s1 = butb19.Name;
                btnAction2(s1);
            }
    
            private void butb20_Click(object sender, EventArgs e)
            {
                string s1 = butb20.Name;
                btnAction2(s1);
            }
    
            private void butb21_Click(object sender, EventArgs e)
            {
                string s1 = butb21.Name;
                btnAction2(s1);
            }
    
            private void butna1_Click(object sender, EventArgs e)
            {
                string s1 = butna1.Name;
                btnAction2(s1);
                lbNum2.Text = "-1";
                lbFloorNum2.Text = "-1";
            }
    
            private void butna2up_Click(object sender, EventArgs e)
            {
                string s1 = butna2up.Name;
                btnAction2(s1);
            }
    
            private void butna3up_Click(object sender, EventArgs e)
            {
                string s1 = butna3up.Name;
                btnAction2(s1);
            }
    
            private void butna4up_Click(object sender, EventArgs e)
            {
                string s1 = butna4up.Name;
                btnAction2(s1);
            }
    
            private void butna5up_Click(object sender, EventArgs e)
            {
                string s1 = butna5up.Name;
                btnAction2(s1);
            }
    
            private void butna6up_Click(object sender, EventArgs e)
            {
                string s1 = butna6up.Name;
                btnAction2(s1);
            }
    
            private void butna7up_Click(object sender, EventArgs e)
            {
                string s1 = butna7up.Name;
                btnAction2(s1);
            }
    
            private void butna8up_Click(object sender, EventArgs e)
            {
                string s1 = butna8up.Name;
                btnAction2(s1);
            }
    
            private void butna9up_Click(object sender, EventArgs e)
            {
                string s1 = butna9up.Name;
                btnAction2(s1);
            }
    
            private void butna10up_Click(object sender, EventArgs e)
            {
                string s1 = butna10up.Name;
                btnAction2(s1);
            }
    
            private void butna11up_Click(object sender, EventArgs e)
            {
                string s1 = butna11up.Name;
                btnAction2(s1);
            }
    
            private void butna12up_Click(object sender, EventArgs e)
            {
                string s1 = butna12up.Name;
                btnAction2(s1);
            }
    
            private void butna13up_Click(object sender, EventArgs e)
            {
                string s1 = butna13up.Name;
                btnAction2(s1);
            }
    
            private void butna14up_Click(object sender, EventArgs e)
            {
                string s1 = butna14up.Name;
                btnAction2(s1);
            }
    
            private void butna15up_Click(object sender, EventArgs e)
            {
                string s1 = butna15up.Name;
                btnAction2(s1);
            }
    
            private void butna16up_Click(object sender, EventArgs e)
            {
                string s1 = butna16up.Name;
                btnAction2(s1);
            }
    
            private void butna17up_Click(object sender, EventArgs e)
            {
                string s1 = butna17up.Name;
                btnAction2(s1);
            }
    
            private void butna18up_Click(object sender, EventArgs e)
            {
                string s1 = butna18up.Name;
                btnAction2(s1);
            }
    
            private void butna19up_Click(object sender, EventArgs e)
            {
                string s1 = butna19up.Name;
                btnAction2(s1);
            }
    
            private void butna20up_Click(object sender, EventArgs e)
            {
                string s1 = butna20up.Name;
                btnAction2(s1);
            }
    
            private void butna21down_Click(object sender, EventArgs e)
            {
                string s1 = butna21down.Name;
                btnAction2(s1);
            }
    
            private void butna20down_Click(object sender, EventArgs e)
            {
                string s1 = butna20down.Name;
                btnAction2(s1);
            }
    
            private void butna19down_Click(object sender, EventArgs e)
            {
                string s1 = butna19down.Name;
                btnAction2(s1);
            }
    
            private void butna18down_Click(object sender, EventArgs e)
            {
                string s1 = butna18down.Name;
                btnAction2(s1);
            }
    
            private void butna17down_Click(object sender, EventArgs e)
            {
                string s1 = butna17down.Name;
                btnAction2(s1);
            }
    
            private void butna16down_Click(object sender, EventArgs e)
            {
                string s1 = butna16down.Name;
                btnAction2(s1);
            }
    
            private void butna15down_Click(object sender, EventArgs e)
            {
                string s1 = butna15down.Name;
                btnAction2(s1);
            }
    
            private void butna14down_Click(object sender, EventArgs e)
            {
                string s1 = butna14down.Name;
                btnAction2(s1);
            }
    
            private void butna13down_Click(object sender, EventArgs e)
            {
                string s1 = butna13down.Name;
                btnAction2(s1);
            }
    
            private void butna12down_Click(object sender, EventArgs e)
            {
                string s1 = butna12down.Name;
                btnAction2(s1);
            }
    
            private void butna11down_Click(object sender, EventArgs e)
            {
                string s1 = butna11down.Name;
                btnAction2(s1);
            }
    
            private void butna10down_Click(object sender, EventArgs e)
            {
                string s1 = butna10down.Name;
                btnAction2(s1);
            }
    
            private void butna9down_Click(object sender, EventArgs e)
            {
                string s1 = butna9down.Name;
                btnAction2(s1);
            }
    
            private void butna8down_Click(object sender, EventArgs e)
            {
                string s1 = butna8down.Name;
                btnAction2(s1);
            }
    
            private void butna7down_Click(object sender, EventArgs e)
            {
                string s1 = butna7down.Name;
                btnAction2(s1);
            }
    
            private void butna6down_Click(object sender, EventArgs e)
            {
                string s1 = butna6down.Name;
                btnAction2(s1);
            }
    
            private void butna5down_Click(object sender, EventArgs e)
            {
                string s1 = butna5down.Name;
                btnAction2(s1);
            }
    
            private void butna4down_Click(object sender, EventArgs e)
            {
                string s1 = butna4down.Name;
                btnAction2(s1);
            }
    
            private void butna3down_Click(object sender, EventArgs e)
            {
                string s1 = butna3down.Name;
                btnAction2(s1);
            }
    
            private void butna2down_Click(object sender, EventArgs e)
            {
                string s1 = butna2down.Name;
                btnAction2(s1);
            }
    
            private void move2_Tick(object sender, EventArgs e)
            {
                if (NumFloor < l.Num)
                {
                    lblup2.ForeColor = Color.Red;
                    for (int i = panel8.Height - NumFloor * n; i >= getfloorLength(); i--)
                    {
                        lift2.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                else
                {
                    lbldown2.ForeColor = Color.Red;
                    for (int i = panel8.Height - NumFloor * n; i <= getfloorLength(); i++)
                    {
                        lift2.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                openDoor2.Interval = 500;
                openDoor2.Start();
                this.Focus();
    
                System.Threading.Thread.CurrentThread.Join(1000);
    
                NumFloor = l.Num;
                lblup2.ForeColor = Color.DimGray;
                lbldown2.ForeColor = Color.DimGray;
    
                lbUp2.ForeColor = Color.DimGray;
                lbDown2.ForeColor = Color.DimGray;
    
                closeDoor2.Interval = 500;
                closeDoor2.Start();
                this.Focus();
                move2.Stop();
            }
    
    
            private void openDoor2_Tick(object sender, EventArgs e)
            {
                for (int bdx = 78; bdx >= 1; bdx--)
                {
                    doorLeft2.Width = bdx;
                    doorRight2.Width = bdx;
                    doorRight2.Location = new Point(80 + 79 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                openDoor2.Stop();
            }
    
            private void openDoor3_Tick(object sender, EventArgs e)
            {
                for (int bdx = 78; bdx >= 1; bdx--)
                {
                    doorLeft3.Width = bdx;
                    doorRight3.Width = bdx;
                    doorRight3.Location = new Point(80 + 79 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                openDoor3.Stop();
            }
    
            private void move3_Tick(object sender, EventArgs e)
            {
                if (NumFloor < l.Num)
                {
                    lblup3.ForeColor = Color.Red;
                    for (int i = panel10.Height - NumFloor * n; i >= getfloorLength(); i--)
                    {
                        lift3.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                else
                {
                    lbldown3.ForeColor = Color.Red;
                    for (int i = panel10.Height - NumFloor * n; i <= getfloorLength(); i++)
                    {
                        //DrawLine();
                        lift3.Location = new Point(0, i);
                        System.Threading.Thread.CurrentThread.Join(10);
                    }
                }
                //DrawLine();
                openDoor3.Interval = 500;
                openDoor3.Start();
                this.Focus();
    
                System.Threading.Thread.CurrentThread.Join(1000);
    
                NumFloor = l.Num;
                lblup3.ForeColor = Color.DimGray;
                lbldown3.ForeColor = Color.DimGray;
    
                lbUp3.ForeColor = Color.DimGray;
                lbDown3.ForeColor = Color.DimGray;
    
                closeDoor3.Interval = 500;
                closeDoor3.Start();
                this.Focus();
                move3.Stop();
            }
    
            private void closeDoor3_Tick(object sender, EventArgs e)
            {
                for (int bdx = 0; bdx <= 79; bdx++)
                {
                    doorLeft3.Width = bdx;
                    doorRight3.Width = bdx;
                    doorRight3.Location = new Point(159 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                closeDoor3.Stop();
            }
    
            private void butc1_Click(object sender, EventArgs e)
            {
                string s1 = butc1.Name;
                btnAction3(s1);
                lbNum3.Text = "-1";
                lbFloorNum3.Text = "-1";
            }
    
            private void butc2_Click(object sender, EventArgs e)
            {
                string s1 = butc2.Name;
                btnAction3(s1);
            }
    
            private void butc3_Click(object sender, EventArgs e)
            {
                string s1 = butc3.Name;
                btnAction3(s1);
            }
    
            private void butc4_Click(object sender, EventArgs e)
            {
                string s1 = butc4.Name;
                btnAction3(s1);
            }
    
            private void butc5_Click(object sender, EventArgs e)
            {
                string s1 = butc5.Name;
                btnAction3(s1);
            }
    
            private void butc6_Click(object sender, EventArgs e)
            {
                string s1 = butc6.Name;
                btnAction3(s1);
            }
    
            private void butc7_Click(object sender, EventArgs e)
            {
                string s1 = butc7.Name;
                btnAction3(s1);
            }
    
            private void butc8_Click(object sender, EventArgs e)
            {
                string s1 = butc8.Name;
                btnAction3(s1);
            }
    
            private void butc9_Click(object sender, EventArgs e)
            {
                string s1 = butc9.Name;
                btnAction3(s1);
            }
    
            private void butc10_Click(object sender, EventArgs e)
            {
                string s1 = butc10.Name;
                btnAction3(s1);
            }
    
            private void butc11_Click(object sender, EventArgs e)
            {
                string s1 = butc11.Name;
                btnAction3(s1);
            }
    
            private void butc12_Click(object sender, EventArgs e)
            {
                string s1 = butc12.Name;
                btnAction3(s1);
            }
    
            private void butc13_Click(object sender, EventArgs e)
            {
                string s1 = butc13.Name;
                btnAction3(s1);
            }
    
            private void butc14_Click(object sender, EventArgs e)
            {
                string s1 = butc14.Name;
                btnAction3(s1);
            }
    
            private void butc15_Click(object sender, EventArgs e)
            {
                string s1 = butc15.Name;
                btnAction3(s1);
            }
    
            private void butc16_Click(object sender, EventArgs e)
            {
                string s1 = butc16.Name;
                btnAction3(s1);
            }
    
            private void butc17_Click(object sender, EventArgs e)
            {
                string s1 = butc17.Name;
                btnAction3(s1);
            }
    
            private void butc18_Click(object sender, EventArgs e)
            {
                string s1 = butc18.Name;
                btnAction3(s1);
            }
    
            private void butc19_Click(object sender, EventArgs e)
            {
                string s1 = butc19.Name;
                btnAction3(s1);
            }
    
            private void butc20_Click(object sender, EventArgs e)
            {
                string s1 = butc20.Name;
                btnAction3(s1);
            }
    
            private void butc21_Click(object sender, EventArgs e)
            {
                string s1 = butc21.Name;
                btnAction3(s1);
            }
    
            private void butnb1_Click(object sender, EventArgs e)
            {
                string s1 = butnb1.Name;
                btnAction3(s1);
                lbNum3.Text = "-1";
                lbFloorNum3.Text = "-1";
            }
    
            private void butnb2up_Click(object sender, EventArgs e)
            {
                string s1 = butnb2up.Name;
                btnAction3(s1);
            }
    
            private void butnb3up_Click(object sender, EventArgs e)
            {
                string s1 = butnb3up.Name;
                btnAction3(s1);
            }
    
            private void butnb4up_Click(object sender, EventArgs e)
            {
                string s1 = butnb4up.Name;
                btnAction3(s1);
            }
    
            private void butnb5up_Click(object sender, EventArgs e)
            {
                string s1 = butnb5up.Name;
                btnAction3(s1);
            }
    
            private void butnb6up_Click(object sender, EventArgs e)
            {
                string s1 = butnb6up.Name;
                btnAction3(s1);
            }
    
            private void butnb7up_Click(object sender, EventArgs e)
            {
                string s1 = butnb7up.Name;
                btnAction3(s1);
            }
    
            private void butnb8up_Click(object sender, EventArgs e)
            {
                string s1 = butnb8up.Name;
                btnAction3(s1);
            }
    
            private void butnb9up_Click(object sender, EventArgs e)
            {
                string s1 = butnb9up.Name;
                btnAction3(s1);
            }
    
            private void butnb10up_Click(object sender, EventArgs e)
            {
                string s1 = butnb10up.Name;
                btnAction3(s1);
            }
    
            private void butnb11up_Click(object sender, EventArgs e)
            {
                string s1 = butnb11up.Name;
                btnAction3(s1);
            }
    
            private void butnb12up_Click(object sender, EventArgs e)
            {
                string s1 = butnb12up.Name;
                btnAction3(s1);
            }
    
            private void butnb13up_Click(object sender, EventArgs e)
            {
                string s1 = butnb13up.Name;
                btnAction3(s1);
            }
    
            private void butnb14up_Click(object sender, EventArgs e)
            {
                string s1 = butnb14up.Name;
                btnAction3(s1);
            }
    
            private void butnb15up_Click(object sender, EventArgs e)
            {
                string s1 = butnb15up.Name;
                btnAction3(s1);
            }
    
            private void butnb16up_Click(object sender, EventArgs e)
            {
                string s1 = butnb16up.Name;
                btnAction3(s1);
            }
    
            private void butnb17up_Click(object sender, EventArgs e)
            {
                string s1 = butnb17up.Name;
                btnAction3(s1);
            }
    
            private void butnb18up_Click(object sender, EventArgs e)
            {
                string s1 = butnb18up.Name;
                btnAction3(s1);
            }
    
            private void butnb19up_Click(object sender, EventArgs e)
            {
                string s1 = butnb19up.Name;
                btnAction3(s1);
            }
    
            private void butnb20up_Click(object sender, EventArgs e)
            {
                string s1 = butnb20up.Name;
                btnAction3(s1);
            }
    
            private void butnb21down_Click(object sender, EventArgs e)
            {
                string s1 = butnb21down.Name;
                btnAction3(s1);
            }
    
            private void butnb20down_Click(object sender, EventArgs e)
            {
                string s1 = butnb20down.Name;
                btnAction3(s1);
            }
    
            private void butnb19down_Click(object sender, EventArgs e)
            {
                string s1 = butnb19down.Name;
                btnAction3(s1);
            }
    
            private void butnb18down_Click(object sender, EventArgs e)
            {
                string s1 = butnb18down.Name;
                btnAction3(s1);
            }
    
            private void butnb17down_Click(object sender, EventArgs e)
            {
                string s1 = butnb17down.Name;
                btnAction3(s1);
            }
    
            private void butnb16down_Click(object sender, EventArgs e)
            {
                string s1 = butnb16down.Name;
                btnAction3(s1);
            }
    
            private void butnb15down_Click(object sender, EventArgs e)
            {
                string s1 = butnb15down.Name;
                btnAction3(s1);
            }
    
            private void groupBox5_Enter(object sender, EventArgs e)
            {
    
            }
    
            private void butnb14down_Click(object sender, EventArgs e)
            {
                string s1 = butnb14down.Name;
                btnAction3(s1);
            }
    
            private void butnb13down_Click(object sender, EventArgs e)
            {
                string s1 = butnb13down.Name;
                btnAction3(s1);
            }
    
            private void butnb12down_Click(object sender, EventArgs e)
            {
                string s1 = butnb12down.Name;
                btnAction3(s1);
            }
    
            private void butnb11down_Click(object sender, EventArgs e)
            {
                string s1 = butnb11down.Name;
                btnAction3(s1);
            }
    
            private void butnb10down_Click(object sender, EventArgs e)
            {
                string s1 = butnb10down.Name;
                btnAction3(s1);
            }
    
            private void butnb9down_Click(object sender, EventArgs e)
            {
                string s1 = butnb9down.Name;
                btnAction3(s1);
            }
    
            private void butnb8down_Click(object sender, EventArgs e)
            {
                string s1 = butnb8down.Name;
                btnAction3(s1);
            }
    
            private void butnb7down_Click(object sender, EventArgs e)
            {
                string s1 = butnb6down.Name;
                btnAction3(s1);
            }
    
            private void butnb6down_Click(object sender, EventArgs e)
            {
                string s1 = butnb6down.Name;
                btnAction3(s1);
            }
    
            private void butnb5down_Click(object sender, EventArgs e)
            {
                string s1 = butnb6down.Name;
                btnAction3(s1);
            }
    
            private void butnb4down_Click(object sender, EventArgs e)
            {
                string s1 = butnb4down.Name;
                btnAction3(s1);
            }
    
            private void butnb3down_Click(object sender, EventArgs e)
            {
                string s1 = butnb3down.Name;
                btnAction3(s1);
            }
    
            private void butnb2down_Click(object sender, EventArgs e)
            {
                string s1 = butnb2down.Name;
                btnAction3(s1);
            }
    
            private void closeDoor2_Tick(object sender, EventArgs e)
            {
                for (int bdx = 0; bdx <= 79; bdx++)
                {
                    doorLeft2.Width = bdx;
                    doorRight2.Width = bdx;
                    doorRight2.Location = new Point(159 - bdx, 0);
                    System.Threading.Thread.CurrentThread.Join(10);
                }
                closeDoor2.Stop();
            }
    
            private void button147_Click(object sender, EventArgs e)
            {
                openDoor2.Interval = 500;
                openDoor2.Start();
                this.Focus();
            }
    
            private void button170_Click(object sender, EventArgs e)
            {
                openDoor3.Interval = 500;
                openDoor3.Start();
                this.Focus();
            }
    
            private void button146_Click(object sender, EventArgs e)
            {
                closeDoor2.Interval = 500;
                closeDoor2.Start();
                this.Focus();
            }
    
            private void button169_Click(object sender, EventArgs e)
            {
                closeDoor3.Interval = 500;
                closeDoor3.Start();
                this.Focus();
            }
    
            
        }
    }
    

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    
    public  class liftC
        {
            //private int Num=0;
            public int Num = 1;//感兴趣的信息,此刻按钮的号码,是几楼的按钮
            public int runSpeed;//电梯运行速度
            public int PersonLimit;//人数限制
            public int doorOCSpeed;//开关门速度
            public int liftDefLocation;//电梯的默认位置
            public int pSpeed;//人员上下的速度
            //声明委托
            public delegate void LiftEventHandler(Object sender, LiftEventArgs e);
            public event LiftEventHandler Lift; //声明事件
    
            public class LiftEventArgs : EventArgs
            {
                public readonly int Num;
                public LiftEventArgs(int Num)
                {
                    this.Num = Num;
                }
            }
    
            // 可以供继承自 Heater 的类重写,以便继承类拒绝其他对象对它的监视
            protected virtual void OnLift(LiftEventArgs e)
            {
                if (Lift != null)
                { // 如果有对象注册
                    Lift(this, e);  // 调用所有注册对象的方法
                }
            }
            // 电梯运动
            public void Run(int Direction)
            {
                //建立BoiledEventArgs 对象。
                LiftEventArgs e = new LiftEventArgs(Num);
                OnLift(e);  // 调用 OnLift方法
    
            }
        }
    

     

    程序截图:

       

     

  • 相关阅读:
    Linux下Kafka单机安装配置
    MySQL30条规范解读
    MySQL联合索引最左匹配范例
    Percona Data Recovery Tool 单表恢复
    SQL中的where条件,在数据库中提取与应用浅析
    【leetcode】908. Smallest Range I
    【leetcode】909. Snakes and Ladders
    【leetcode】910. Smallest Range II
    【leetcode】395. Longest Substring with At Least K Repeating Characters
    【leetcode】907. Sum of Subarray Minimums
  • 原文地址:https://www.cnblogs.com/liusanlong/p/3615077.html
Copyright © 2020-2023  润新知