C#实现四部电梯的调度

电梯调度

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

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

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

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

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

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

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

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

   7月20号:编写博客!

程序思想:

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

程序代码:

   1 using System;
   2 using System.Collections.Generic;
   3 using System.ComponentModel;
   4 using System.Data;
   5 using System.Drawing;
   6 using System.Linq;
   7 using System.Text;
   8 using System.Windows.Forms;
   9  
  10 namespace Elecator
  11 {
  12     public partial class Form1 : Form
  13     {
  14         private Image myImage2;
  15         private Image myImage3;
  16         int NumFloor = 1;
  17         int isDoorOpen = 0;//0为关门,1为开门
  18         public static liftC l = new liftC();
  19        // public control c = new control();
  20         public const int n = 23;
  21  
  22         public Form1()
  23         {
  24             InitializeComponent();
  25         }
  26  
  27         private void Form1_Load(object sender, EventArgs e)
  28         {
  29             myImage2 = new Bitmap(panel1.Width, panel1.Height);//电梯运动
  30             myImage3 = new Bitmap(panel6.Width, panel6.Height);
  31         }
  32  
  33         public void manage()
  34         {
  35             //int[] stack = new Array();
  36  
  37         }
  38  
  39         protected override void OnPaint(PaintEventArgs e)
  40         {
  41             //DrawLine();
  42             base.OnPaint(e);
  43         }
  44  
  45         private void textBox1_TextChanged(object sender, EventArgs e)
  46         {
  47  
  48         }
  49  
  50         private void panel1_Paint(object sender, PaintEventArgs e)
  51         {
  52  
  53         }
  54         public int getfloorLength()
  55         {
  56             return panel1.Height - l.Num * n;
  57         }
  58  
  59         private void pictureBox1_Click(object sender, EventArgs e)
  60         {
  61  
  62         }
  63  
  64         private void button1Up_Click(object sender, EventArgs e)
  65         {
  66             string s1 = button2Up.Name;
  67             btnAction(s1);
  68         }
  69  
  70         private void button20Up_Click(object sender, EventArgs e)
  71         {
  72             string s1 = button20Up.Name;
  73             btnAction(s1);
  74         }
  75  
  76         private void button1Down_Click(object sender, EventArgs e)
  77         {
  78             string s1 = button2Down.Name;
  79             btnAction(s1);
  80         }
  81  
  82         private void buttonUp_Click(object sender, EventArgs e)
  83         {
  84             string s1 = button2Up.Name;
  85             btnAction(s1);
  86         }
  87  
  88         private void button2Down_Click(object sender, EventArgs e)
  89         {
  90             string s1 = button3Down.Name;
  91             btnAction(s1);
  92         }
  93  
  94         private void button1Down_Click_1(object sender, EventArgs e)
  95         {
  96             string s1 = button2Down.Name;
  97             btnAction(s1);
  98         }
  99  
 100         private void button0Up_Click_1(object sender, EventArgs e)
 101         {
 102             string s1 = button1Up.Name;
 103             btnAction(s1);
 104         }
 105  
 106         public void btnAction(string s1)
 107         {
 108             if (getFloor(s1) < l.Num)
 109             {
 110                 lbldown.ForeColor = Color.Red;
 111                 lbDown.ForeColor = Color.Red;
 112             }
 113             else if (getFloor(s1) > l.Num)
 114             {
 115                 lblup.ForeColor = Color.Red;
 116                 lbUp.ForeColor = Color.Red;
 117             }
 118             l.Num = getFloor(s1);
 119             lbNum.Text = (l.Num-1).ToString();
 120             lbFloorNum.Text = (l.Num-1).ToString();
 121             move.Interval = 1000;
 122             move.Start();
 123         }
 124  
 125         private void doorLeft_Paint(object sender, PaintEventArgs e)
 126         {
 127  
 128         }
 129  
 130         public int getFloor(string letter)
 131         {
 132             string s1 = letter;
 133             string str = "";
 134             foreach (char s in s1)
 135             {
 136                 if (s <= 58 && s >= 48)
 137                 {
 138                     str += s;
 139                 }
 140             }
 141             return int.Parse(str);
 142         }
 143  
 144         private void openDoor_Tick(object sender, EventArgs e)
 145         {
 146             for (int bdx = 78; bdx >= 1; bdx--)
 147             {
 148                 doorLeft.Width = bdx;
 149                 doorRight.Width = bdx;
 150                 doorRight.Location = new Point(80 + 79 - bdx, 0);
 151                 System.Threading.Thread.CurrentThread.Join(10);
 152             }
 153             openDoor.Stop();
 154  
 155         }
 156  
 157         private void closeDoor_Tick(object sender, EventArgs e)
 158         {
 159             for (int bdx = 0; bdx <= 79; bdx++)
 160             {
 161                 doorLeft.Width = bdx;
 162                 doorRight.Width = bdx;
 163                 doorRight.Location = new Point(159 - bdx, 0);
 164                 System.Threading.Thread.CurrentThread.Join(10);
 165             }
 166             closeDoor.Stop();
 167         }
 168  
 169         private void lblup_Click(object sender, EventArgs e)
 170         {
 171  
 172         }
 173  
 174         private void panel4_Paint(object sender, PaintEventArgs e)
 175         {
 176  
 177         }
 178  
 179         private void groupBox1_Enter(object sender, EventArgs e)
 180         {
 181  
 182         }
 183  
 184         private void button3Up_Click(object sender, EventArgs e)
 185         {
 186             string s1 = button4Up.Name;
 187             btnAction(s1);
 188         }
 189  
 190         private void button4Down_Click(object sender, EventArgs e)
 191         {
 192             string s1 = button4Down.Name;
 193             btnAction(s1);
 194         }
 195  
 196         private void button2Up_Click_1(object sender, EventArgs e)
 197         {
 198             string s1 = button2Up.Name;
 199             btnAction(s1);
 200         }
 201  
 202         private void button2Down_Click_2(object sender, EventArgs e)
 203         {
 204             string s1 = button2Down.Name;
 205             btnAction(s1);
 206         }
 207  
 208         private void button62_Click(object sender, EventArgs e)
 209         {
 210             openDoor.Interval = 500;
 211             openDoor.Start();
 212             this.Focus();
 213         }
 214  
 215         private void button63_Click(object sender, EventArgs e)
 216         {
 217             closeDoor.Interval = 500;
 218             closeDoor.Start();
 219             this.Focus();
 220         }
 221  
 222  
 223         private void but3_Click(object sender, EventArgs e)
 224         {
 225             string s1 = but3.Name;
 226             btnAction(s1);
 227         }
 228  
 229  
 230         private void button2Up_Click(object sender, EventArgs e)
 231         {
 232             string s1 = button2Up.Name;
 233             btnAction(s1);
 234         }
 235  
 236         private void move_Tick(object sender, EventArgs e)
 237         {
 238             if (NumFloor < l.Num)
 239             {
 240                 lblup.ForeColor = Color.Red;
 241                 for (int i = panel1.Height - NumFloor * n; i >= getfloorLength(); i--)
 242                 {
 243                     lift.Location = new Point(0, i);
 244                     System.Threading.Thread.CurrentThread.Join(10);
 245                 }
 246             }
 247             else
 248             {
 249                 lbldown.ForeColor = Color.Red;
 250                 for (int i = panel1.Height - NumFloor * n; i <= getfloorLength(); i++)
 251                 {
 252                     //DrawLine();
 253                     lift.Location = new Point(0, i);
 254                     System.Threading.Thread.CurrentThread.Join(10);
 255                 }
 256             }
 257             //DrawLine();
 258             openDoor.Interval = 500;
 259             openDoor.Start();
 260             this.Focus();
 261  
 262             System.Threading.Thread.CurrentThread.Join(1000);
 263  
 264             NumFloor = l.Num;
 265             lblup.ForeColor = Color.DimGray;
 266             lbldown.ForeColor = Color.DimGray;
 267  
 268             lbUp.ForeColor = Color.DimGray;
 269             lbDown.ForeColor = Color.DimGray;
 270  
 271             closeDoor.Interval = 500;
 272             closeDoor.Start();
 273             this.Focus();
 274             move.Stop();
 275         }
 276  
 277         private void button1Up_Click_1(object sender, EventArgs e)
 278         {
 279             string s1 = button1Up.Name;
 280             btnAction(s1);
 281             lbNum.Text = "-1";
 282             lbFloorNum.Text = "-1";
 283         }
 284  
 285         private void button3Up_Click_1(object sender, EventArgs e)
 286         {
 287             string s1 = button3Up.Name;
 288             btnAction(s1);
 289         }
 290  
 291         private void button4Up_Click(object sender, EventArgs e)
 292         {
 293             string s1 = button4Up.Name;
 294             btnAction(s1);
 295         }
 296  
 297         private void button3Down_Click(object sender, EventArgs e)
 298         {
 299             string s1 = button3Down.Name;
 300             btnAction(s1);
 301         }
 302  
 303  
 304         private void but1_Click(object sender, EventArgs e)
 305         {
 306             string s1 = but1.Name;
 307             btnAction(s1);
 308             lbNum.Text = "-1";
 309             lbFloorNum.Text ="-1";
 310         }
 311  
 312         private void but5_Click(object sender, EventArgs e)
 313         {
 314             string s1 = but5.Name;
 315             btnAction(s1);
 316         }
 317  
 318         private void but6_Click(object sender, EventArgs e)
 319         {
 320             string s1 = but6.Name;
 321             btnAction(s1);
 322         }
 323  
 324         private void but4_Click(object sender, EventArgs e)
 325         {
 326             string s1 = but4.Name;
 327             btnAction(s1);
 328         }
 329  
 330         private void button4Down_Click_1(object sender, EventArgs e)
 331         {
 332             string s1 = button4Down.Name;
 333             btnAction(s1);
 334         }
 335  
 336         private void but2_Click(object sender, EventArgs e)
 337         {
 338             string s1 = but2.Name;
 339             btnAction(s1);
 340         }
 341  
 342         private void but3_Click_1(object sender, EventArgs e)
 343         {
 344             string s1 = but3.Name;
 345             btnAction(s1);
 346         }
 347  
 348         private void but7_Click(object sender, EventArgs e)
 349         {
 350             string s1 = but7.Name;
 351             btnAction(s1);
 352         }
 353  
 354         private void but8_Click(object sender, EventArgs e)
 355         {
 356             string s1 = but8.Name;
 357             btnAction(s1);
 358         }
 359  
 360         private void but9_Click(object sender, EventArgs e)
 361         {
 362             string s1 = but9.Name;
 363             btnAction(s1);
 364         }
 365  
 366         private void but10_Click(object sender, EventArgs e)
 367         {
 368             string s1 = but10.Name;
 369             btnAction(s1);
 370         }
 371  
 372         private void but11_Click(object sender, EventArgs e)
 373         {
 374             string s1 = but11.Name;
 375             btnAction(s1);
 376         }
 377  
 378         private void but12_Click(object sender, EventArgs e)
 379         {
 380             string s1 = but12.Name;
 381             btnAction(s1);
 382         }
 383  
 384         private void but13_Click(object sender, EventArgs e)
 385         {
 386             string s1 = but13.Name;
 387             btnAction(s1);
 388         }
 389  
 390         private void but14_Click(object sender, EventArgs e)
 391         {
 392             string s1 = but14.Name;
 393             btnAction(s1);
 394         }
 395  
 396         private void but15_Click(object sender, EventArgs e)
 397         {
 398             string s1 = but15.Name;
 399             btnAction(s1);
 400         }
 401  
 402         private void but16_Click(object sender, EventArgs e)
 403         {
 404             string s1 = but16.Name;
 405             btnAction(s1);
 406         }
 407  
 408         private void but17_Click(object sender, EventArgs e)
 409         {
 410             string s1 = but17.Name;
 411             btnAction(s1);
 412         }
 413  
 414         private void but18_Click(object sender, EventArgs e)
 415         {
 416             string s1 = but18.Name;
 417             btnAction(s1);
 418         }
 419  
 420         private void but19_Click(object sender, EventArgs e)
 421         {
 422             string s1 = but19.Name;
 423             btnAction(s1);
 424         }
 425  
 426         private void but20_Click(object sender, EventArgs e)
 427         {
 428             string s1 = but20.Name;
 429             btnAction(s1);
 430         }
 431  
 432         private void but21_Click(object sender, EventArgs e)
 433         {
 434             string s1 = but21.Name;
 435             btnAction(s1);
 436         }
 437  
 438         private void button5Down_Click(object sender, EventArgs e)
 439         {
 440             string s1 = button5Down.Name;
 441             btnAction(s1);
 442         }
 443  
 444         private void button6Down_Click(object sender, EventArgs e)
 445         {
 446             string s1 = button6Down.Name;
 447             btnAction(s1);
 448         }
 449  
 450         private void button7Down_Click(object sender, EventArgs e)
 451         {
 452             string s1 = button7Down.Name;
 453             btnAction(s1);
 454         }
 455  
 456         private void button8Down_Click(object sender, EventArgs e)
 457         {
 458             string s1 = button8Down.Name;
 459             btnAction(s1);
 460         }
 461  
 462         private void button9Down_Click(object sender, EventArgs e)
 463         {
 464             string s1 = button9Down.Name;
 465             btnAction(s1);
 466         }
 467  
 468         private void button10Down_Click(object sender, EventArgs e)
 469         {
 470             string s1 = button10Down.Name;
 471             btnAction(s1);
 472         }
 473  
 474         private void button11Down_Click(object sender, EventArgs e)
 475         {
 476             string s1 = button11Down.Name;
 477             btnAction(s1);
 478         }
 479  
 480         private void button12Down_Click(object sender, EventArgs e)
 481         {
 482             string s1 = button12Down.Name;
 483             btnAction(s1);
 484         }
 485  
 486         private void button13Down_Click(object sender, EventArgs e)
 487         {
 488             string s1 = button13Down.Name;
 489             btnAction(s1);
 490         }
 491  
 492         private void button14Down_Click(object sender, EventArgs e)
 493         {
 494             string s1 = button14Down.Name;
 495             btnAction(s1);
 496         }
 497  
 498         private void button15Down_Click(object sender, EventArgs e)
 499         {
 500             string s1 = button15Down.Name;
 501             btnAction(s1);
 502         }
 503  
 504         private void button16Down_Click(object sender, EventArgs e)
 505         {
 506             string s1 = button16Down.Name;
 507             btnAction(s1);
 508         }
 509  
 510         private void button17Down_Click(object sender, EventArgs e)
 511         {
 512             string s1 = button17Down.Name;
 513             btnAction(s1);
 514         }
 515  
 516         private void button18Down_Click(object sender, EventArgs e)
 517         {
 518             string s1 = button18Down.Name;
 519             btnAction(s1);
 520         }
 521  
 522         private void button19Down_Click(object sender, EventArgs e)
 523         {
 524             string s1 = button19Down.Name;
 525             btnAction(s1);
 526         }
 527  
 528         private void button20Down_Click(object sender, EventArgs e)
 529         {
 530             string s1 = button20Down.Name;
 531             btnAction(s1);
 532         }
 533  
 534         private void button21Down_Click(object sender, EventArgs e)
 535         {
 536             string s1 = button21Down.Name;
 537             btnAction(s1);
 538         }
 539  
 540         private void button18Up_Click_1(object sender, EventArgs e)
 541         {
 542             string s1 = button18Up.Name;
 543             btnAction(s1);
 544         }
 545  
 546         private void button9Up_Click_1(object sender, EventArgs e)
 547         {
 548             string s1 = button9Up.Name;
 549             btnAction(s1);
 550         }
 551  
 552         private void button10Up_Click_1(object sender, EventArgs e)
 553         {
 554             string s1 = button10Up.Name;
 555             btnAction(s1);
 556         }
 557  
 558         private void button6Up_Click(object sender, EventArgs e)
 559         {
 560             string s1 = button6Up.Name;
 561             btnAction(s1);
 562         }
 563  
 564         private void button7Up_Click(object sender, EventArgs e)
 565         {
 566             string s1 = button7Up.Name;
 567             btnAction(s1);
 568         }
 569  
 570         private void button8Up_Click(object sender, EventArgs e)
 571         {
 572             string s1 = button8Up.Name;
 573             btnAction(s1);
 574         }
 575  
 576         private void button11Up_Click(object sender, EventArgs e)
 577         {
 578             string s1 = button11Up.Name;
 579             btnAction(s1);
 580         }
 581  
 582         private void button12Up_Click(object sender, EventArgs e)
 583         {
 584             string s1 = button12Up.Name;
 585             btnAction(s1);
 586         }
 587  
 588         private void button13Up_Click(object sender, EventArgs e)
 589         {
 590             string s1 = button13Up.Name;
 591             btnAction(s1);
 592         }
 593  
 594         private void button14Up_Click(object sender, EventArgs e)
 595         {
 596             string s1 = button14Up.Name;
 597             btnAction(s1);
 598         }
 599  
 600         private void button15Up_Click(object sender, EventArgs e)
 601         {
 602             string s1 = button15Up.Name;
 603             btnAction(s1);
 604         }
 605  
 606         private void button16Up_Click(object sender, EventArgs e)
 607         {
 608             string s1 = button16Up.Name;
 609             btnAction(s1);
 610         }
 611  
 612         private void button17Up_Click(object sender, EventArgs e)
 613         {
 614             string s1 = button17Up.Name;
 615             btnAction(s1);
 616         }
 617  
 618         private void button19Up_Click(object sender, EventArgs e)
 619         {
 620             string s1 = button19Up.Name;
 621             btnAction(s1);
 622         }
 623  
 624         private void button3_Click(object sender, EventArgs e)
 625         {
 626  
 627         }
 628  
 629         private void lbldown_Click(object sender, EventArgs e)
 630         {
 631  
 632         }
 633  
 634         public void btnAction1(string s1)
 635         {
 636             if (getFloor(s1) < l.Num)
 637             {
 638                 lbldown1.ForeColor = Color.Red;
 639                 lbDown1.ForeColor = Color.Red;
 640             }
 641             else if (getFloor(s1) > l.Num)
 642             {
 643                 lblup1.ForeColor = Color.Red;
 644                 lbUp1.ForeColor = Color.Red;
 645             }
 646             l.Num = getFloor(s1);
 647             lbNum1.Text = (l.Num - 1).ToString();
 648             lbFloorNum1.Text = (l.Num - 1).ToString();
 649             move1.Interval = 1000;
 650             move1.Start();
 651         }
 652  
 653         public void btnAction2(string s1)
 654         {
 655             if (getFloor(s1) < l.Num)
 656             {
 657                 lbldown2.ForeColor = Color.Red;
 658                 lbDown2.ForeColor = Color.Red;
 659             }
 660             else if (getFloor(s1) > l.Num)
 661             {
 662                 lblup2.ForeColor = Color.Red;
 663                 lbUp2.ForeColor = Color.Red;
 664             }
 665             l.Num = getFloor(s1);
 666             lbNum2.Text = (l.Num - 1).ToString();
 667             lbFloorNum2.Text = (l.Num - 1).ToString();
 668             move.Interval = 1000;
 669             move2.Start();
 670         }
 671  
 672         public void btnAction3(string s1)
 673         {
 674             if (getFloor(s1) < l.Num)
 675             {
 676                 lbldown3.ForeColor = Color.Red;
 677                 lbDown3.ForeColor = Color.Red;
 678             }
 679             else if (getFloor(s1) > l.Num)
 680             {
 681                 lblup3.ForeColor = Color.Red;
 682                 lbUp3.ForeColor = Color.Red;
 683             }
 684             l.Num = getFloor(s1);
 685             lbNum3.Text = (l.Num - 1).ToString();
 686             lbFloorNum3.Text = (l.Num - 1).ToString();
 687             move.Interval = 1000;
 688             move3.Start();
 689         }
 690  
 691         private void move1_Tick(object sender, EventArgs e)
 692         {
 693             if (NumFloor < l.Num)
 694             {
 695                 lblup1.ForeColor = Color.Red;
 696                 for (int i = panel6.Height - NumFloor * n; i >= getfloorLength(); i--)
 697                 {
 698                     lift1.Location = new Point(0, i);
 699                     System.Threading.Thread.CurrentThread.Join(10);
 700                 }
 701             }
 702             else
 703             {
 704                 lbldown1.ForeColor = Color.Red;
 705                 for (int i = panel6.Height - NumFloor * n; i <= getfloorLength(); i++)
 706                 {
 707                     lift1.Location = new Point(0, i);
 708                     System.Threading.Thread.CurrentThread.Join(10);
 709                 }
 710             }
 711             openDoor1.Interval = 500;
 712             openDoor1.Start();
 713             this.Focus();
 714  
 715             System.Threading.Thread.CurrentThread.Join(1000);
 716  
 717             NumFloor = l.Num;
 718             lblup1.ForeColor = Color.DimGray;
 719             lbldown1.ForeColor = Color.DimGray;
 720  
 721             lbUp1.ForeColor = Color.DimGray;
 722             lbDown1.ForeColor = Color.DimGray;
 723  
 724             closeDoor1.Interval = 500;
 725             closeDoor1.Start();
 726             this.Focus();
 727             move1.Stop();
 728         }
 729  
 730         private void butn1_Click(object sender, EventArgs e)
 731         {
 732             string s1 = butn1.Name;
 733             btnAction1(s1);
 734             lbNum1.Text = "-1";
 735             lbFloorNum1.Text = "-1";
 736         }
 737  
 738         private void button2Up_Click_2(object sender, EventArgs e)
 739         {
 740             string s1 = button2Up.Name;
 741             btnAction(s1);
 742         }
 743  
 744         private void button2Down_Click_1(object sender, EventArgs e)
 745         {
 746             string s1 = button2Down.Name;
 747             btnAction(s1);
 748         }
 749  
 750         private void but2up_Click(object sender, EventArgs e)
 751         {
 752             string s1 = but2up.Name;
 753             btnAction1(s1);
 754         }
 755  
 756         private void but3up_Click(object sender, EventArgs e)
 757         {
 758             string s1 = but3up.Name;
 759             btnAction1(s1);
 760         }
 761  
 762         private void but4up_Click(object sender, EventArgs e)
 763         {
 764             string s1 = but4up.Name;
 765             btnAction1(s1);
 766         }
 767  
 768         private void but5up_Click(object sender, EventArgs e)
 769         {
 770             string s1 = but5up.Name;
 771             btnAction1(s1);
 772         }
 773  
 774         private void but6up_Click(object sender, EventArgs e)
 775         {
 776             string s1 = but6up.Name;
 777             btnAction1(s1);
 778         }
 779  
 780         private void openDoor1_Tick(object sender, EventArgs e)
 781         {
 782             for (int bdx = 78; bdx >= 1; bdx--)
 783             {
 784  
 785                 doorLeft1.Width = bdx;
 786                 doorRight1.Width = bdx;
 787                 doorRight1.Location = new Point(80 + 79 - bdx, 0);
 788                 System.Threading.Thread.CurrentThread.Join(10);
 789             }
 790             openDoor1.Stop();
 791         }
 792  
 793         private void closeDoor1_Tick(object sender, EventArgs e)
 794         {
 795             for (int bdx = 0; bdx <= 79; bdx++)
 796             {
 797                 doorLeft1.Width = bdx;
 798                 doorRight1.Width = bdx;
 799                 doorRight1.Location = new Point(159 - bdx, 0);
 800                 System.Threading.Thread.CurrentThread.Join(10);
 801             }
 802             closeDoor1.Stop();
 803         }
 804  
 805         private void but7up_Click(object sender, EventArgs e)
 806         {
 807             string s1 = but7up.Name;
 808             btnAction1(s1);
 809         }
 810  
 811         private void but8up_Click(object sender, EventArgs e)
 812         {
 813             string s1 = but8up.Name;
 814             btnAction1(s1);
 815         }
 816  
 817         private void but9up_Click(object sender, EventArgs e)
 818         {
 819             string s1 = but9up.Name;
 820             btnAction1(s1);
 821         }
 822  
 823         private void but10up_Click(object sender, EventArgs e)
 824         {
 825             string s1 = but10up.Name;
 826             btnAction1(s1);
 827         }
 828  
 829         private void but11up_Click(object sender, EventArgs e)
 830         {
 831             string s1 = but11up.Name;
 832             btnAction1(s1);
 833         }
 834  
 835         private void but12up_Click(object sender, EventArgs e)
 836         {
 837             string s1 = but12up.Name;
 838             btnAction1(s1);
 839         }
 840  
 841         private void but13up_Click(object sender, EventArgs e)
 842         {
 843             string s1 = but13up.Name;
 844             btnAction1(s1);
 845         }
 846  
 847         private void but14up_Click(object sender, EventArgs e)
 848         {
 849             string s1 = but14up.Name;
 850             btnAction1(s1);
 851         }
 852  
 853         private void but15up_Click(object sender, EventArgs e)
 854         {
 855             string s1 = but15up.Name;
 856             btnAction1(s1);
 857         }
 858  
 859         private void but16up_Click(object sender, EventArgs e)
 860         {
 861             string s1 = but16up.Name;
 862             btnAction1(s1);
 863         }
 864  
 865         private void but17up_Click(object sender, EventArgs e)
 866         {
 867             string s1 = but17up.Name;
 868             btnAction1(s1);
 869         }
 870  
 871         private void but18up_Click(object sender, EventArgs e)
 872         {
 873             string s1 = but18up.Name;
 874             btnAction1(s1);
 875         }
 876  
 877         private void but19up_Click(object sender, EventArgs e)
 878         {
 879             string s1 = but19up.Name;
 880             btnAction1(s1);
 881         }
 882  
 883         private void but20up_Click(object sender, EventArgs e)
 884         {
 885             string s1 = but20up.Name;
 886             btnAction1(s1);
 887         }
 888  
 889         private void but21down_Click(object sender, EventArgs e)
 890         {
 891             string s1 = but21down.Name;
 892             btnAction1(s1);
 893         }
 894  
 895         private void but20down_Click(object sender, EventArgs e)
 896         {
 897             string s1 = but20down.Name;
 898             btnAction1(s1);
 899         }
 900  
 901         private void but19down_Click(object sender, EventArgs e)
 902         {
 903             string s1 = but19down.Name;
 904             btnAction1(s1);
 905         }
 906  
 907         private void but18down_Click(object sender, EventArgs e)
 908         {
 909             string s1 = but18down.Name;
 910             btnAction1(s1);
 911         }
 912  
 913         private void but17down_Click(object sender, EventArgs e)
 914         {
 915             string s1 = but17down.Name;
 916             btnAction1(s1);
 917         }
 918  
 919         private void but16down_Click(object sender, EventArgs e)
 920         {
 921             string s1 = but16down.Name;
 922             btnAction1(s1);
 923         }
 924  
 925         private void but15down_Click(object sender, EventArgs e)
 926         {
 927             string s1 = but15down.Name;
 928             btnAction1(s1);
 929         }
 930  
 931         private void but14down_Click(object sender, EventArgs e)
 932         {
 933             string s1 = but14down.Name;
 934             btnAction1(s1);
 935         }
 936  
 937         private void but13down_Click(object sender, EventArgs e)
 938         {
 939             string s1 = but13down.Name;
 940             btnAction1(s1);
 941         }
 942  
 943         private void but12down_Click(object sender, EventArgs e)
 944         {
 945             string s1 = but12down.Name;
 946             btnAction1(s1);
 947         }
 948  
 949         private void but11down_Click(object sender, EventArgs e)
 950         {
 951             string s1 = but11down.Name;
 952             btnAction1(s1);
 953         }
 954  
 955         private void but10down_Click(object sender, EventArgs e)
 956         {
 957             string s1 = but10down.Name;
 958             btnAction1(s1);
 959         }
 960  
 961         private void but9down_Click(object sender, EventArgs e)
 962         {
 963             string s1 = but9down.Name;
 964             btnAction1(s1);
 965         }
 966  
 967         private void but8down_Click(object sender, EventArgs e)
 968         {
 969             string s1 = but8down.Name;
 970             btnAction1(s1);
 971         }
 972  
 973         private void but7down_Click(object sender, EventArgs e)
 974         {
 975             string s1 = but7down.Name;
 976             btnAction1(s1);
 977         }
 978  
 979         private void but6down_Click(object sender, EventArgs e)
 980         {
 981             string s1 = but6down.Name;
 982             btnAction1(s1);
 983         }
 984  
 985         private void but5down_Click(object sender, EventArgs e)
 986         {
 987             string s1 = but5down.Name;
 988             btnAction1(s1);
 989         }
 990  
 991         private void but4down_Click(object sender, EventArgs e)
 992         {
 993             string s1 = but4down.Name;
 994             btnAction1(s1);
 995         }
 996  
 997         private void but3down_Click(object sender, EventArgs e)
 998         {
 999             string s1 = but3down.Name;
1000             btnAction1(s1);
1001         }
1002  
1003         private void but2down_Click(object sender, EventArgs e)
1004         {
1005             string s1 = but2down.Name;
1006             btnAction1(s1);
1007         }
1008  
1009         private void buta1_Click(object sender, EventArgs e)
1010         {
1011             string s1 = buta1.Name;
1012             btnAction1(s1);
1013             lbNum1.Text = "-1";
1014             lbFloorNum1.Text = "-1";
1015         }
1016  
1017         private void buta2_Click(object sender, EventArgs e)
1018         {
1019             string s1 = but2.Name;
1020             btnAction1(s1);
1021         }
1022  
1023         private void buta3_Click(object sender, EventArgs e)
1024         {
1025             string s1 = but3.Name;
1026             btnAction1(s1);
1027         }
1028  
1029         private void buta4_Click(object sender, EventArgs e)
1030         {
1031             string s1 = but4.Name;
1032             btnAction1(s1);
1033         }
1034  
1035         private void buta5_Click(object sender, EventArgs e)
1036         {
1037             string s1 = but5.Name;
1038             btnAction1(s1);
1039         }
1040  
1041         private void buta6_Click(object sender, EventArgs e)
1042         {
1043             string s1 = but6.Name;
1044             btnAction1(s1);
1045         }
1046  
1047         private void buta7_Click(object sender, EventArgs e)
1048         {
1049             string s1 = but7.Name;
1050             btnAction1(s1);
1051         }
1052  
1053         private void buta8_Click(object sender, EventArgs e)
1054         {
1055             string s1 = but8.Name;
1056             btnAction1(s1);
1057         }
1058  
1059         private void buta9_Click(object sender, EventArgs e)
1060         {
1061             string s1 = but9.Name;
1062             btnAction1(s1);
1063         }
1064  
1065         private void buta10_Click(object sender, EventArgs e)
1066         {
1067             string s1 = but10.Name;
1068             btnAction1(s1);
1069         }
1070  
1071         private void buta11_Click(object sender, EventArgs e)
1072         {
1073             string s1 = but11.Name;
1074             btnAction1(s1);
1075         }
1076  
1077         private void buta12_Click(object sender, EventArgs e)
1078         {
1079             string s1 = but12.Name;
1080             btnAction1(s1);
1081         }
1082  
1083         private void buta13_Click(object sender, EventArgs e)
1084         {
1085             string s1 = but13.Name;
1086             btnAction1(s1);
1087         }
1088  
1089         private void buta14_Click(object sender, EventArgs e)
1090         {
1091             string s1 = but14.Name;
1092             btnAction1(s1);
1093         }
1094  
1095         private void buta15_Click(object sender, EventArgs e)
1096         {
1097             string s1 = but15.Name;
1098             btnAction1(s1);
1099         }
1100  
1101         private void buta16_Click(object sender, EventArgs e)
1102         {
1103             string s1 = but16.Name;
1104             btnAction1(s1);
1105         }
1106  
1107         private void buta17_Click(object sender, EventArgs e)
1108         {
1109             string s1 = but17.Name;
1110             btnAction1(s1);
1111         }
1112  
1113         private void buta18_Click(object sender, EventArgs e)
1114         {
1115             string s1 = but18.Name;
1116             btnAction1(s1);
1117         }
1118  
1119         private void buta19_Click(object sender, EventArgs e)
1120         {
1121             string s1 = but19.Name;
1122             btnAction1(s1);
1123         }
1124  
1125         private void buta20_Click(object sender, EventArgs e)
1126         {
1127             string s1 = but20.Name;
1128             btnAction1(s1);
1129         }
1130  
1131         private void buta21_Click(object sender, EventArgs e)
1132         {
1133             string s1 = but21.Name;
1134             btnAction1(s1);
1135         }
1136  
1137         private void button124_Click(object sender, EventArgs e)
1138         {
1139             openDoor1.Interval = 500;
1140             openDoor1.Start();
1141             this.Focus();
1142         }
1143  
1144         private void button123_Click(object sender, EventArgs e)
1145         {
1146             closeDoor1.Interval = 500;
1147             closeDoor1.Start();
1148             this.Focus();
1149         }
1150  
1151         private void butb1_Click(object sender, EventArgs e)
1152         {
1153             string s1 = butb1.Name;
1154             btnAction2(s1);
1155             lbNum2.Text = "-1";
1156             lbFloorNum2.Text = "-1";
1157         }
1158  
1159         private void butb2_Click(object sender, EventArgs e)
1160         {
1161             string s1 = butb2.Name;
1162             btnAction2(s1);
1163         }
1164  
1165         private void butb3_Click(object sender, EventArgs e)
1166         {
1167             string s1 = butb3.Name;
1168             btnAction2(s1);
1169         }
1170  
1171         private void butb4_Click(object sender, EventArgs e)
1172         {
1173             string s1 = butb4.Name;
1174             btnAction2(s1);
1175         }
1176  
1177         private void butb5_Click(object sender, EventArgs e)
1178         {
1179             string s1 = butb5.Name;
1180             btnAction2(s1);
1181         }
1182  
1183         private void butb6_Click(object sender, EventArgs e)
1184         {
1185             string s1 = butb6.Name;
1186             btnAction2(s1);
1187         }
1188  
1189         private void butb7_Click(object sender, EventArgs e)
1190         {
1191             string s1 = butb7.Name;
1192             btnAction2(s1);
1193         }
1194  
1195         private void butb8_Click(object sender, EventArgs e)
1196         {
1197             string s1 = butb8.Name;
1198             btnAction2(s1);
1199         }
1200  
1201         private void butb9_Click(object sender, EventArgs e)
1202         {
1203             string s1 = butb9.Name;
1204             btnAction2(s1);
1205         }
1206  
1207         private void butb10_Click(object sender, EventArgs e)
1208         {
1209             string s1 = butb10.Name;
1210             btnAction2(s1);
1211         }
1212  
1213         private void butb11_Click(object sender, EventArgs e)
1214         {
1215             string s1 = butb11.Name;
1216             btnAction2(s1);
1217         }
1218  
1219         private void butb12_Click(object sender, EventArgs e)
1220         {
1221             string s1 = butb12.Name;
1222             btnAction2(s1);
1223         }
1224  
1225         private void butb13_Click(object sender, EventArgs e)
1226         {
1227             string s1 = butb13.Name;
1228             btnAction2(s1);
1229         }
1230  
1231         private void butb14_Click(object sender, EventArgs e)
1232         {
1233             string s1 = butb14.Name;
1234             btnAction2(s1);
1235         }
1236  
1237         private void butb15_Click(object sender, EventArgs e)
1238         {
1239             string s1 = butb15.Name;
1240             btnAction2(s1);
1241         }
1242  
1243         private void butb16_Click(object sender, EventArgs e)
1244         {
1245             string s1 = butb16.Name;
1246             btnAction2(s1);
1247         }
1248  
1249         private void butb17_Click(object sender, EventArgs e)
1250         {
1251             string s1 = butb17.Name;
1252             btnAction2(s1);
1253         }
1254  
1255         private void butb18_Click(object sender, EventArgs e)
1256         {
1257             string s1 = butb18.Name;
1258             btnAction2(s1);
1259         }
1260  
1261         private void butb19_Click(object sender, EventArgs e)
1262         {
1263             string s1 = butb19.Name;
1264             btnAction2(s1);
1265         }
1266  
1267         private void butb20_Click(object sender, EventArgs e)
1268         {
1269             string s1 = butb20.Name;
1270             btnAction2(s1);
1271         }
1272  
1273         private void butb21_Click(object sender, EventArgs e)
1274         {
1275             string s1 = butb21.Name;
1276             btnAction2(s1);
1277         }
1278  
1279         private void butna1_Click(object sender, EventArgs e)
1280         {
1281             string s1 = butna1.Name;
1282             btnAction2(s1);
1283             lbNum2.Text = "-1";
1284             lbFloorNum2.Text = "-1";
1285         }
1286  
1287         private void butna2up_Click(object sender, EventArgs e)
1288         {
1289             string s1 = butna2up.Name;
1290             btnAction2(s1);
1291         }
1292  
1293         private void butna3up_Click(object sender, EventArgs e)
1294         {
1295             string s1 = butna3up.Name;
1296             btnAction2(s1);
1297         }
1298  
1299         private void butna4up_Click(object sender, EventArgs e)
1300         {
1301             string s1 = butna4up.Name;
1302             btnAction2(s1);
1303         }
1304  
1305         private void butna5up_Click(object sender, EventArgs e)
1306         {
1307             string s1 = butna5up.Name;
1308             btnAction2(s1);
1309         }
1310  
1311         private void butna6up_Click(object sender, EventArgs e)
1312         {
1313             string s1 = butna6up.Name;
1314             btnAction2(s1);
1315         }
1316  
1317         private void butna7up_Click(object sender, EventArgs e)
1318         {
1319             string s1 = butna7up.Name;
1320             btnAction2(s1);
1321         }
1322  
1323         private void butna8up_Click(object sender, EventArgs e)
1324         {
1325             string s1 = butna8up.Name;
1326             btnAction2(s1);
1327         }
1328  
1329         private void butna9up_Click(object sender, EventArgs e)
1330         {
1331             string s1 = butna9up.Name;
1332             btnAction2(s1);
1333         }
1334  
1335         private void butna10up_Click(object sender, EventArgs e)
1336         {
1337             string s1 = butna10up.Name;
1338             btnAction2(s1);
1339         }
1340  
1341         private void butna11up_Click(object sender, EventArgs e)
1342         {
1343             string s1 = butna11up.Name;
1344             btnAction2(s1);
1345         }
1346  
1347         private void butna12up_Click(object sender, EventArgs e)
1348         {
1349             string s1 = butna12up.Name;
1350             btnAction2(s1);
1351         }
1352  
1353         private void butna13up_Click(object sender, EventArgs e)
1354         {
1355             string s1 = butna13up.Name;
1356             btnAction2(s1);
1357         }
1358  
1359         private void butna14up_Click(object sender, EventArgs e)
1360         {
1361             string s1 = butna14up.Name;
1362             btnAction2(s1);
1363         }
1364  
1365         private void butna15up_Click(object sender, EventArgs e)
1366         {
1367             string s1 = butna15up.Name;
1368             btnAction2(s1);
1369         }
1370  
1371         private void butna16up_Click(object sender, EventArgs e)
1372         {
1373             string s1 = butna16up.Name;
1374             btnAction2(s1);
1375         }
1376  
1377         private void butna17up_Click(object sender, EventArgs e)
1378         {
1379             string s1 = butna17up.Name;
1380             btnAction2(s1);
1381         }
1382  
1383         private void butna18up_Click(object sender, EventArgs e)
1384         {
1385             string s1 = butna18up.Name;
1386             btnAction2(s1);
1387         }
1388  
1389         private void butna19up_Click(object sender, EventArgs e)
1390         {
1391             string s1 = butna19up.Name;
1392             btnAction2(s1);
1393         }
1394  
1395         private void butna20up_Click(object sender, EventArgs e)
1396         {
1397             string s1 = butna20up.Name;
1398             btnAction2(s1);
1399         }
1400  
1401         private void butna21down_Click(object sender, EventArgs e)
1402         {
1403             string s1 = butna21down.Name;
1404             btnAction2(s1);
1405         }
1406  
1407         private void butna20down_Click(object sender, EventArgs e)
1408         {
1409             string s1 = butna20down.Name;
1410             btnAction2(s1);
1411         }
1412  
1413         private void butna19down_Click(object sender, EventArgs e)
1414         {
1415             string s1 = butna19down.Name;
1416             btnAction2(s1);
1417         }
1418  
1419         private void butna18down_Click(object sender, EventArgs e)
1420         {
1421             string s1 = butna18down.Name;
1422             btnAction2(s1);
1423         }
1424  
1425         private void butna17down_Click(object sender, EventArgs e)
1426         {
1427             string s1 = butna17down.Name;
1428             btnAction2(s1);
1429         }
1430  
1431         private void butna16down_Click(object sender, EventArgs e)
1432         {
1433             string s1 = butna16down.Name;
1434             btnAction2(s1);
1435         }
1436  
1437         private void butna15down_Click(object sender, EventArgs e)
1438         {
1439             string s1 = butna15down.Name;
1440             btnAction2(s1);
1441         }
1442  
1443         private void butna14down_Click(object sender, EventArgs e)
1444         {
1445             string s1 = butna14down.Name;
1446             btnAction2(s1);
1447         }
1448  
1449         private void butna13down_Click(object sender, EventArgs e)
1450         {
1451             string s1 = butna13down.Name;
1452             btnAction2(s1);
1453         }
1454  
1455         private void butna12down_Click(object sender, EventArgs e)
1456         {
1457             string s1 = butna12down.Name;
1458             btnAction2(s1);
1459         }
1460  
1461         private void butna11down_Click(object sender, EventArgs e)
1462         {
1463             string s1 = butna11down.Name;
1464             btnAction2(s1);
1465         }
1466  
1467         private void butna10down_Click(object sender, EventArgs e)
1468         {
1469             string s1 = butna10down.Name;
1470             btnAction2(s1);
1471         }
1472  
1473         private void butna9down_Click(object sender, EventArgs e)
1474         {
1475             string s1 = butna9down.Name;
1476             btnAction2(s1);
1477         }
1478  
1479         private void butna8down_Click(object sender, EventArgs e)
1480         {
1481             string s1 = butna8down.Name;
1482             btnAction2(s1);
1483         }
1484  
1485         private void butna7down_Click(object sender, EventArgs e)
1486         {
1487             string s1 = butna7down.Name;
1488             btnAction2(s1);
1489         }
1490  
1491         private void butna6down_Click(object sender, EventArgs e)
1492         {
1493             string s1 = butna6down.Name;
1494             btnAction2(s1);
1495         }
1496  
1497         private void butna5down_Click(object sender, EventArgs e)
1498         {
1499             string s1 = butna5down.Name;
1500             btnAction2(s1);
1501         }
1502  
1503         private void butna4down_Click(object sender, EventArgs e)
1504         {
1505             string s1 = butna4down.Name;
1506             btnAction2(s1);
1507         }
1508  
1509         private void butna3down_Click(object sender, EventArgs e)
1510         {
1511             string s1 = butna3down.Name;
1512             btnAction2(s1);
1513         }
1514  
1515         private void butna2down_Click(object sender, EventArgs e)
1516         {
1517             string s1 = butna2down.Name;
1518             btnAction2(s1);
1519         }
1520  
1521         private void move2_Tick(object sender, EventArgs e)
1522         {
1523             if (NumFloor < l.Num)
1524             {
1525                 lblup2.ForeColor = Color.Red;
1526                 for (int i = panel8.Height - NumFloor * n; i >= getfloorLength(); i--)
1527                 {
1528                     lift2.Location = new Point(0, i);
1529                     System.Threading.Thread.CurrentThread.Join(10);
1530                 }
1531             }
1532             else
1533             {
1534                 lbldown2.ForeColor = Color.Red;
1535                 for (int i = panel8.Height - NumFloor * n; i <= getfloorLength(); i++)
1536                 {
1537                     lift2.Location = new Point(0, i);
1538                     System.Threading.Thread.CurrentThread.Join(10);
1539                 }
1540             }
1541             openDoor2.Interval = 500;
1542             openDoor2.Start();
1543             this.Focus();
1544  
1545             System.Threading.Thread.CurrentThread.Join(1000);
1546  
1547             NumFloor = l.Num;
1548             lblup2.ForeColor = Color.DimGray;
1549             lbldown2.ForeColor = Color.DimGray;
1550  
1551             lbUp2.ForeColor = Color.DimGray;
1552             lbDown2.ForeColor = Color.DimGray;
1553  
1554             closeDoor2.Interval = 500;
1555             closeDoor2.Start();
1556             this.Focus();
1557             move2.Stop();
1558         }
1559  
1560  
1561         private void openDoor2_Tick(object sender, EventArgs e)
1562         {
1563             for (int bdx = 78; bdx >= 1; bdx--)
1564             {
1565                 doorLeft2.Width = bdx;
1566                 doorRight2.Width = bdx;
1567                 doorRight2.Location = new Point(80 + 79 - bdx, 0);
1568                 System.Threading.Thread.CurrentThread.Join(10);
1569             }
1570             openDoor2.Stop();
1571         }
1572  
1573         private void openDoor3_Tick(object sender, EventArgs e)
1574         {
1575             for (int bdx = 78; bdx >= 1; bdx--)
1576             {
1577                 doorLeft3.Width = bdx;
1578                 doorRight3.Width = bdx;
1579                 doorRight3.Location = new Point(80 + 79 - bdx, 0);
1580                 System.Threading.Thread.CurrentThread.Join(10);
1581             }
1582             openDoor3.Stop();
1583         }
1584  
1585         private void move3_Tick(object sender, EventArgs e)
1586         {
1587             if (NumFloor < l.Num)
1588             {
1589                 lblup3.ForeColor = Color.Red;
1590                 for (int i = panel10.Height - NumFloor * n; i >= getfloorLength(); i--)
1591                 {
1592                     lift3.Location = new Point(0, i);
1593                     System.Threading.Thread.CurrentThread.Join(10);
1594                 }
1595             }
1596             else
1597             {
1598                 lbldown3.ForeColor = Color.Red;
1599                 for (int i = panel10.Height - NumFloor * n; i <= getfloorLength(); i++)
1600                 {
1601                     //DrawLine();
1602                     lift3.Location = new Point(0, i);
1603                     System.Threading.Thread.CurrentThread.Join(10);
1604                 }
1605             }
1606             //DrawLine();
1607             openDoor3.Interval = 500;
1608             openDoor3.Start();
1609             this.Focus();
1610  
1611             System.Threading.Thread.CurrentThread.Join(1000);
1612  
1613             NumFloor = l.Num;
1614             lblup3.ForeColor = Color.DimGray;
1615             lbldown3.ForeColor = Color.DimGray;
1616  
1617             lbUp3.ForeColor = Color.DimGray;
1618             lbDown3.ForeColor = Color.DimGray;
1619  
1620             closeDoor3.Interval = 500;
1621             closeDoor3.Start();
1622             this.Focus();
1623             move3.Stop();
1624         }
1625  
1626         private void closeDoor3_Tick(object sender, EventArgs e)
1627         {
1628             for (int bdx = 0; bdx <= 79; bdx++)
1629             {
1630                 doorLeft3.Width = bdx;
1631                 doorRight3.Width = bdx;
1632                 doorRight3.Location = new Point(159 - bdx, 0);
1633                 System.Threading.Thread.CurrentThread.Join(10);
1634             }
1635             closeDoor3.Stop();
1636         }
1637  
1638         private void butc1_Click(object sender, EventArgs e)
1639         {
1640             string s1 = butc1.Name;
1641             btnAction3(s1);
1642             lbNum3.Text = "-1";
1643             lbFloorNum3.Text = "-1";
1644         }
1645  
1646         private void butc2_Click(object sender, EventArgs e)
1647         {
1648             string s1 = butc2.Name;
1649             btnAction3(s1);
1650         }
1651  
1652         private void butc3_Click(object sender, EventArgs e)
1653         {
1654             string s1 = butc3.Name;
1655             btnAction3(s1);
1656         }
1657  
1658         private void butc4_Click(object sender, EventArgs e)
1659         {
1660             string s1 = butc4.Name;
1661             btnAction3(s1);
1662         }
1663  
1664         private void butc5_Click(object sender, EventArgs e)
1665         {
1666             string s1 = butc5.Name;
1667             btnAction3(s1);
1668         }
1669  
1670         private void butc6_Click(object sender, EventArgs e)
1671         {
1672             string s1 = butc6.Name;
1673             btnAction3(s1);
1674         }
1675  
1676         private void butc7_Click(object sender, EventArgs e)
1677         {
1678             string s1 = butc7.Name;
1679             btnAction3(s1);
1680         }
1681  
1682         private void butc8_Click(object sender, EventArgs e)
1683         {
1684             string s1 = butc8.Name;
1685             btnAction3(s1);
1686         }
1687  
1688         private void butc9_Click(object sender, EventArgs e)
1689         {
1690             string s1 = butc9.Name;
1691             btnAction3(s1);
1692         }
1693  
1694         private void butc10_Click(object sender, EventArgs e)
1695         {
1696             string s1 = butc10.Name;
1697             btnAction3(s1);
1698         }
1699  
1700         private void butc11_Click(object sender, EventArgs e)
1701         {
1702             string s1 = butc11.Name;
1703             btnAction3(s1);
1704         }
1705  
1706         private void butc12_Click(object sender, EventArgs e)
1707         {
1708             string s1 = butc12.Name;
1709             btnAction3(s1);
1710         }
1711  
1712         private void butc13_Click(object sender, EventArgs e)
1713         {
1714             string s1 = butc13.Name;
1715             btnAction3(s1);
1716         }
1717  
1718         private void butc14_Click(object sender, EventArgs e)
1719         {
1720             string s1 = butc14.Name;
1721             btnAction3(s1);
1722         }
1723  
1724         private void butc15_Click(object sender, EventArgs e)
1725         {
1726             string s1 = butc15.Name;
1727             btnAction3(s1);
1728         }
1729  
1730         private void butc16_Click(object sender, EventArgs e)
1731         {
1732             string s1 = butc16.Name;
1733             btnAction3(s1);
1734         }
1735  
1736         private void butc17_Click(object sender, EventArgs e)
1737         {
1738             string s1 = butc17.Name;
1739             btnAction3(s1);
1740         }
1741  
1742         private void butc18_Click(object sender, EventArgs e)
1743         {
1744             string s1 = butc18.Name;
1745             btnAction3(s1);
1746         }
1747  
1748         private void butc19_Click(object sender, EventArgs e)
1749         {
1750             string s1 = butc19.Name;
1751             btnAction3(s1);
1752         }
1753  
1754         private void butc20_Click(object sender, EventArgs e)
1755         {
1756             string s1 = butc20.Name;
1757             btnAction3(s1);
1758         }
1759  
1760         private void butc21_Click(object sender, EventArgs e)
1761         {
1762             string s1 = butc21.Name;
1763             btnAction3(s1);
1764         }
1765  
1766         private void butnb1_Click(object sender, EventArgs e)
1767         {
1768             string s1 = butnb1.Name;
1769             btnAction3(s1);
1770             lbNum3.Text = "-1";
1771             lbFloorNum3.Text = "-1";
1772         }
1773  
1774         private void butnb2up_Click(object sender, EventArgs e)
1775         {
1776             string s1 = butnb2up.Name;
1777             btnAction3(s1);
1778         }
1779  
1780         private void butnb3up_Click(object sender, EventArgs e)
1781         {
1782             string s1 = butnb3up.Name;
1783             btnAction3(s1);
1784         }
1785  
1786         private void butnb4up_Click(object sender, EventArgs e)
1787         {
1788             string s1 = butnb4up.Name;
1789             btnAction3(s1);
1790         }
1791  
1792         private void butnb5up_Click(object sender, EventArgs e)
1793         {
1794             string s1 = butnb5up.Name;
1795             btnAction3(s1);
1796         }
1797  
1798         private void butnb6up_Click(object sender, EventArgs e)
1799         {
1800             string s1 = butnb6up.Name;
1801             btnAction3(s1);
1802         }
1803  
1804         private void butnb7up_Click(object sender, EventArgs e)
1805         {
1806             string s1 = butnb7up.Name;
1807             btnAction3(s1);
1808         }
1809  
1810         private void butnb8up_Click(object sender, EventArgs e)
1811         {
1812             string s1 = butnb8up.Name;
1813             btnAction3(s1);
1814         }
1815  
1816         private void butnb9up_Click(object sender, EventArgs e)
1817         {
1818             string s1 = butnb9up.Name;
1819             btnAction3(s1);
1820         }
1821  
1822         private void butnb10up_Click(object sender, EventArgs e)
1823         {
1824             string s1 = butnb10up.Name;
1825             btnAction3(s1);
1826         }
1827  
1828         private void butnb11up_Click(object sender, EventArgs e)
1829         {
1830             string s1 = butnb11up.Name;
1831             btnAction3(s1);
1832         }
1833  
1834         private void butnb12up_Click(object sender, EventArgs e)
1835         {
1836             string s1 = butnb12up.Name;
1837             btnAction3(s1);
1838         }
1839  
1840         private void butnb13up_Click(object sender, EventArgs e)
1841         {
1842             string s1 = butnb13up.Name;
1843             btnAction3(s1);
1844         }
1845  
1846         private void butnb14up_Click(object sender, EventArgs e)
1847         {
1848             string s1 = butnb14up.Name;
1849             btnAction3(s1);
1850         }
1851  
1852         private void butnb15up_Click(object sender, EventArgs e)
1853         {
1854             string s1 = butnb15up.Name;
1855             btnAction3(s1);
1856         }
1857  
1858         private void butnb16up_Click(object sender, EventArgs e)
1859         {
1860             string s1 = butnb16up.Name;
1861             btnAction3(s1);
1862         }
1863  
1864         private void butnb17up_Click(object sender, EventArgs e)
1865         {
1866             string s1 = butnb17up.Name;
1867             btnAction3(s1);
1868         }
1869  
1870         private void butnb18up_Click(object sender, EventArgs e)
1871         {
1872             string s1 = butnb18up.Name;
1873             btnAction3(s1);
1874         }
1875  
1876         private void butnb19up_Click(object sender, EventArgs e)
1877         {
1878             string s1 = butnb19up.Name;
1879             btnAction3(s1);
1880         }
1881  
1882         private void butnb20up_Click(object sender, EventArgs e)
1883         {
1884             string s1 = butnb20up.Name;
1885             btnAction3(s1);
1886         }
1887  
1888         private void butnb21down_Click(object sender, EventArgs e)
1889         {
1890             string s1 = butnb21down.Name;
1891             btnAction3(s1);
1892         }
1893  
1894         private void butnb20down_Click(object sender, EventArgs e)
1895         {
1896             string s1 = butnb20down.Name;
1897             btnAction3(s1);
1898         }
1899  
1900         private void butnb19down_Click(object sender, EventArgs e)
1901         {
1902             string s1 = butnb19down.Name;
1903             btnAction3(s1);
1904         }
1905  
1906         private void butnb18down_Click(object sender, EventArgs e)
1907         {
1908             string s1 = butnb18down.Name;
1909             btnAction3(s1);
1910         }
1911  
1912         private void butnb17down_Click(object sender, EventArgs e)
1913         {
1914             string s1 = butnb17down.Name;
1915             btnAction3(s1);
1916         }
1917  
1918         private void butnb16down_Click(object sender, EventArgs e)
1919         {
1920             string s1 = butnb16down.Name;
1921             btnAction3(s1);
1922         }
1923  
1924         private void butnb15down_Click(object sender, EventArgs e)
1925         {
1926             string s1 = butnb15down.Name;
1927             btnAction3(s1);
1928         }
1929  
1930         private void groupBox5_Enter(object sender, EventArgs e)
1931         {
1932  
1933         }
1934  
1935         private void butnb14down_Click(object sender, EventArgs e)
1936         {
1937             string s1 = butnb14down.Name;
1938             btnAction3(s1);
1939         }
1940  
1941         private void butnb13down_Click(object sender, EventArgs e)
1942         {
1943             string s1 = butnb13down.Name;
1944             btnAction3(s1);
1945         }
1946  
1947         private void butnb12down_Click(object sender, EventArgs e)
1948         {
1949             string s1 = butnb12down.Name;
1950             btnAction3(s1);
1951         }
1952  
1953         private void butnb11down_Click(object sender, EventArgs e)
1954         {
1955             string s1 = butnb11down.Name;
1956             btnAction3(s1);
1957         }
1958  
1959         private void butnb10down_Click(object sender, EventArgs e)
1960         {
1961             string s1 = butnb10down.Name;
1962             btnAction3(s1);
1963         }
1964  
1965         private void butnb9down_Click(object sender, EventArgs e)
1966         {
1967             string s1 = butnb9down.Name;
1968             btnAction3(s1);
1969         }
1970  
1971         private void butnb8down_Click(object sender, EventArgs e)
1972         {
1973             string s1 = butnb8down.Name;
1974             btnAction3(s1);
1975         }
1976  
1977         private void butnb7down_Click(object sender, EventArgs e)
1978         {
1979             string s1 = butnb6down.Name;
1980             btnAction3(s1);
1981         }
1982  
1983         private void butnb6down_Click(object sender, EventArgs e)
1984         {
1985             string s1 = butnb6down.Name;
1986             btnAction3(s1);
1987         }
1988  
1989         private void butnb5down_Click(object sender, EventArgs e)
1990         {
1991             string s1 = butnb6down.Name;
1992             btnAction3(s1);
1993         }
1994  
1995         private void butnb4down_Click(object sender, EventArgs e)
1996         {
1997             string s1 = butnb4down.Name;
1998             btnAction3(s1);
1999         }
2000  
2001         private void butnb3down_Click(object sender, EventArgs e)
2002         {
2003             string s1 = butnb3down.Name;
2004             btnAction3(s1);
2005         }
2006  
2007         private void butnb2down_Click(object sender, EventArgs e)
2008         {
2009             string s1 = butnb2down.Name;
2010             btnAction3(s1);
2011         }
2012  
2013         private void closeDoor2_Tick(object sender, EventArgs e)
2014         {
2015             for (int bdx = 0; bdx <= 79; bdx++)
2016             {
2017                 doorLeft2.Width = bdx;
2018                 doorRight2.Width = bdx;
2019                 doorRight2.Location = new Point(159 - bdx, 0);
2020                 System.Threading.Thread.CurrentThread.Join(10);
2021             }
2022             closeDoor2.Stop();
2023         }
2024  
2025         private void button147_Click(object sender, EventArgs e)
2026         {
2027             openDoor2.Interval = 500;
2028             openDoor2.Start();
2029             this.Focus();
2030         }
2031  
2032         private void button170_Click(object sender, EventArgs e)
2033         {
2034             openDoor3.Interval = 500;
2035             openDoor3.Start();
2036             this.Focus();
2037         }
2038  
2039         private void button146_Click(object sender, EventArgs e)
2040         {
2041             closeDoor2.Interval = 500;
2042             closeDoor2.Start();
2043             this.Focus();
2044         }
2045  
2046         private void button169_Click(object sender, EventArgs e)
2047         {
2048             closeDoor3.Interval = 500;
2049             closeDoor3.Start();
2050             this.Focus();
2051         }
2052  
2053          
2054     }
2055 }
2056 
2057  
2058 using System;
2059 using System.Collections.Generic;
2060 using System.Linq;
2061 using System.Text;
2062  
2063 public  class liftC
2064     {
2065         //private int Num=0;
2066         public int Num = 1;//感兴趣的信息,此刻按钮的号码,是几楼的按钮
2067         public int runSpeed;//电梯运行速度
2068         public int PersonLimit;//人数限制
2069         public int doorOCSpeed;//开关门速度
2070         public int liftDefLocation;//电梯的默认位置
2071         public int pSpeed;//人员上下的速度
2072         //声明委托
2073         public delegate void LiftEventHandler(Object sender, LiftEventArgs e);
2074         public event LiftEventHandler Lift; //声明事件
2075  
2076         public class LiftEventArgs : EventArgs
2077         {
2078             public readonly int Num;
2079             public LiftEventArgs(int Num)
2080             {
2081                 this.Num = Num;
2082             }
2083         }
2084  
2085         // 可以供继承自 Heater 的类重写,以便继承类拒绝其他对象对它的监视
2086         protected virtual void OnLift(LiftEventArgs e)
2087         {
2088             if (Lift != null)
2089             { // 如果有对象注册
2090                 Lift(this, e);  // 调用所有注册对象的方法
2091             }
2092         }
2093         // 电梯运动
2094         public void Run(int Direction)
2095         {
2096             //建立BoiledEventArgs 对象。
2097             LiftEventArgs e = new LiftEventArgs(Num);
2098             OnLift(e);  // 调用 OnLift方法
2099  
2100         }
2101     }
程序截图:

 

posted @ 2017-07-20 12:05  码农9300  阅读(1475)  评论(4编辑  收藏  举报