小组成员:贾川 李驭龙
经过近几天的反复思,再联系到实际操作方面,我们终于遵循一步一个脚印的原则整体实现了电梯的调度,四个电梯,n多个按钮,每一步都实现了其上下的调度功能,先面试我们具体的计划实施:
3月10号 经过了用c++编写的过程,最后,我们果断的用c#对四部电梯的调度。下午去了图书馆借了关于c#的资料进行学习。
3月11午 通过上网查阅相关的资料和与同学们的交流,我们大体有了一个实现电梯调度的概念以及需要用到的相关知识,同时我们进行了分工,贾川负责电梯调度页面的设计,李驭龙查看资料学习页面设计所用到的一些组件的编程方法;
3月13号:我们一起看了设计出来的运行界面,感觉界面太不够大,承载不了四部电梯form窗体有点不够用,界面也不够直观易看懂,经过一起讨论和设计,我们调整了页面布局,同时也使页面比以前更易看明白。
3月15号:我们开始了电梯调度的编程,程序的思路在下面介绍,第一天我们在创建的电梯调度的类里面写下了程序的大体框架
3月17号下午我们依据写好的程序框架开始了具体的编程,一下午我们一边编写程序一边讨论程序的逻辑问题以及算法的合理问题
3月18号下午:我们继续上次的编程,函数的编写有点问题,编好一部电梯的程序运行时,程序虽然没有语法错误,但运行的结果出不来,不动或乱动,电梯的运动方向总是和我们预想的不一样,还有程序的响应次序也不对,只能继续修改。
3月19号:在第一部电梯的基础上,我们完成了其他三部的程序,并运行,结果良好。
源程序代码如下:
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 dianti
{
public partial class Form1 : Form
{
private Image myImage2;
int NumFloor = 1;
public static liftC l = new liftC();
public const int n = 20;
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
/// ------------------------按钮行为------------------------------------///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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);
}
public int getfloorLength()
{
return panel1.Height - l.Num * n;
}
private void b21up_Click(object sender, EventArgs e)
{
string s1 = b21up.Name;
btnAction(s1);
}
private void b0dn_Click(object sender, EventArgs e)
{
string s1 = b21dn.Name;
btnAction(s1);
}
private void b1up_Click(object sender, EventArgs e)
{
string s1 = b1up.Name;
btnAction(s1);
}
private void b1dn_Click(object sender, EventArgs e)
{
string s1 = b1dn.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 = 10;
move.Start();
}
//////////////
public void btnAction1(string s1)
{
if (getFloor(s1) < l.Num)
{
lbldowna.ForeColor = Color.Red;
lbDowna.ForeColor = Color.Red;
}
else if (getFloor(s1) > l.Num)
{
lblupa.ForeColor = Color.Red;
lbUpa.ForeColor = Color.Red;
}
l.Num = getFloor(s1);
lbNuma.Text = (l.Num-1).ToString();
lbFloorNuma.Text = (l.Num-1).ToString();
move1.Interval = 10;
move1.Start();
}
public void btnAction2(string s1)
{
if (getFloor(s1) < l.Num)
{
lbldownb.ForeColor = Color.Red;
lbDownb.ForeColor = Color.Red;
}
else if (getFloor(s1) > l.Num)
{
lblupb.ForeColor = Color.Red;
lbUpb.ForeColor = Color.Red;
}
l.Num = getFloor(s1);
lbNumb.Text = (l.Num - 1).ToString();
lbFloorNumb.Text = (l.Num - 1).ToString();
move2.Interval = 10;
move2.Start();
}
public void btnAction3(string s1)
{
if (getFloor(s1) < l.Num)
{
lbldownc.ForeColor = Color.Red;
lbDownc.ForeColor = Color.Red;
}
else if (getFloor(s1) > l.Num)
{
lblupc.ForeColor = Color.Red;
lbUpc.ForeColor = Color.Red;
}
l.Num = getFloor(s1);
lbNumc.Text = (l.Num - 1).ToString();
lbFloorNumc.Text = (l.Num - 1).ToString();
move3.Interval = 10;
move3.Start();
}
private void b1_Click(object sender, EventArgs e)
{
string s1 = b1.Name;
btnAction(s1);
lbNum.Text = "-1";
lbFloorNum.Text = "-1";
}
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(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
else
{
lbldown.ForeColor = Color.Red;
for (int i = panel1.Height - NumFloor * n; i <= getfloorLength(); i++)
{
lift.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
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;
this.Focus();
move.Stop();
}
private void lift_Click(object sender, EventArgs e)
{
}
private void b2up_Click(object sender, EventArgs e)
{
string s1 = b2up.Name;
btnAction(s1);
}
private void b2dn_Click(object sender, EventArgs e)
{
string s1 = b2dn.Name;
btnAction(s1);
}
private void Form1_Load(object sender, EventArgs e)
{
myImage2 = new Bitmap(panel1.Width, panel1.Height);//电梯运动
}
private void b2_Click(object sender, EventArgs e)
{
string s1 = b2.Name;
btnAction(s1);
}
private void b3up_Click(object sender, EventArgs e)
{
string s1 = b3up.Name;
btnAction(s1);
}
private void b3dn_Click(object sender, EventArgs e)
{
string s1 = b3dn.Name;
btnAction(s1);
}
private void b3_Click(object sender, EventArgs e)
{
string s1 = b3.Name;
btnAction(s1);
}
private void b21dn_Click(object sender, EventArgs e)
{
string s1 = b21.Name;
btnAction(s1);
}
private void b21up_Click_1(object sender, EventArgs e)
{
string s1 = b21.Name;
btnAction(s1);
}
private void b18_Click(object sender, EventArgs e)
{
string s1 = b18.Name;
btnAction(s1);
}
private void b4up_Click(object sender, EventArgs e)
{
string s1 = b4.Name;
btnAction(s1);
}
private void b4dn_Click(object sender, EventArgs e)
{
string s1 = b4.Name;
btnAction(s1);
}
private void b4_Click(object sender, EventArgs e)
{
string s1 = b4.Name;
btnAction(s1);
}
private void b5up_Click(object sender, EventArgs e)
{
string s1 = b5.Name;
btnAction(s1);
}
private void b5dn_Click(object sender, EventArgs e)
{
string s1 = b5.Name;
btnAction(s1);
}
private void b5_Click(object sender, EventArgs e)
{
string s1 = b5.Name;
btnAction(s1);
}
private void b6up_Click(object sender, EventArgs e)
{
string s1 = b6.Name;
btnAction(s1);
}
private void b6dn_Click(object sender, EventArgs e)
{
string s1 = b6.Name;
btnAction(s1);
}
private void b6_Click(object sender, EventArgs e)
{
string s1 = b6.Name;
btnAction(s1);
}
private void b7up_Click(object sender, EventArgs e)
{
string s1 = b7.Name;
btnAction(s1);
}
private void b7dn_Click(object sender, EventArgs e)
{
string s1 = b7.Name;
btnAction(s1);
}
private void b7_Click(object sender, EventArgs e)
{
string s1 = b7.Name;
btnAction(s1);
}
private void b8up_Click(object sender, EventArgs e)
{
string s1 = b8.Name;
btnAction(s1);
}
private void b8dn_Click(object sender, EventArgs e)
{
string s1 = b8.Name;
btnAction(s1);
}
private void b8_Click(object sender, EventArgs e)
{
string s1 = b8.Name;
btnAction(s1);
}
private void b9up_Click(object sender, EventArgs e)
{
string s1 = b9.Name;
btnAction(s1);
}
private void b9dn_Click(object sender, EventArgs e)
{
string s1 = b9.Name;
btnAction(s1);
}
private void b9_Click(object sender, EventArgs e)
{
string s1 = b9.Name;
btnAction(s1);
}
private void b10up_Click(object sender, EventArgs e)
{
string s1 = b10.Name;
btnAction(s1);
}
private void b10dn_Click(object sender, EventArgs e)
{
string s1 = b10.Name;
btnAction(s1);
}
private void b10_Click(object sender, EventArgs e)
{
string s1 = b10.Name;
btnAction(s1);
}
private void b12up_Click(object sender, EventArgs e)
{
string s1 = b12.Name;
btnAction(s1);
}
private void b11up_Click(object sender, EventArgs e)
{
string s1 = b11.Name;
btnAction(s1);
}
private void b11dn_Click(object sender, EventArgs e)
{
string s1 = b11.Name;
btnAction(s1);
}
private void b11_Click(object sender, EventArgs e)
{
string s1 = b11.Name;
btnAction(s1);
}
private void b12dn_Click(object sender, EventArgs e)
{
string s1 = b12.Name;
btnAction(s1);
}
private void b12_Click(object sender, EventArgs e)
{
string s1 = b12.Name;
btnAction(s1);
}
private void b13up_Click(object sender, EventArgs e)
{
string s1 = b13.Name;
btnAction(s1);
}
private void b13dn_Click(object sender, EventArgs e)
{
string s1 = b13.Name;
btnAction(s1);
}
private void b13_Click(object sender, EventArgs e)
{
string s1 = b13.Name;
btnAction(s1);
}
private void b14up_Click(object sender, EventArgs e)
{
string s1 = b14.Name;
btnAction(s1);
}
private void b14dn_Click(object sender, EventArgs e)
{
string s1 = b14.Name;
btnAction(s1);
}
private void b14_Click(object sender, EventArgs e)
{
string s1 = b14.Name;
btnAction(s1);
}
private void b15up_Click(object sender, EventArgs e)
{
string s1 = b15.Name;
btnAction(s1);
}
private void b15dn_Click(object sender, EventArgs e)
{
string s1 = b15.Name;
btnAction(s1);
}
private void b15_Click(object sender, EventArgs e)
{
string s1 = b15.Name;
btnAction(s1);
}
private void b16up_Click(object sender, EventArgs e)
{
string s1 = b16.Name;
btnAction(s1);
}
private void b16dn_Click(object sender, EventArgs e)
{
string s1 = b16.Name;
btnAction(s1);
}
private void b16_Click(object sender, EventArgs e)
{
string s1 = b16.Name;
btnAction(s1);
}
private void b17up_Click(object sender, EventArgs e)
{
string s1 = b17.Name;
btnAction(s1);
}
private void b17dn_Click(object sender, EventArgs e)
{
string s1 = b17.Name;
btnAction(s1);
}
private void b17_Click(object sender, EventArgs e)
{
string s1 = b17.Name;
btnAction(s1);
}
private void b18up_Click(object sender, EventArgs e)
{
string s1 = b18.Name;
btnAction(s1);
}
private void b18dn_Click(object sender, EventArgs e)
{
string s1 = b18.Name;
btnAction(s1);
}
private void b19up_Click(object sender, EventArgs e)
{
string s1 = b19.Name;
btnAction(s1);
}
private void b19dn_Click(object sender, EventArgs e)
{
string s1 = b19.Name;
btnAction(s1);
}
private void b19_Click(object sender, EventArgs e)
{
string s1 = b19.Name;
btnAction(s1);
}
private void b20up_Click(object sender, EventArgs e)
{
string s1 = b20.Name;
btnAction(s1);
}
private void b20dn_Click(object sender, EventArgs e)
{
string s1 = b20.Name;
btnAction(s1);
}
private void b20_Click(object sender, EventArgs e)
{
string s1 = b20.Name;
btnAction(s1);
}
private void b21_Click(object sender, EventArgs e)
{
string s1 = b21.Name;
btnAction(s1);
}
private void label22_Click(object sender, EventArgs e)
{
}
private void b1a_Click(object sender, EventArgs e)
{
string s1 = b1a.Name;
btnAction1(s1);
}
private void b2a_Click(object sender, EventArgs e)
{
string s1 = b2a.Name;
btnAction1(s1);
}
private void b1upa_Click(object sender, EventArgs e)
{
string s1 = b1upa.Name;
btnAction1(s1);
}
private void b1dna_Click(object sender, EventArgs e)
{
string s1 = b1dna.Name;
btnAction1(s1);
}
private void b2upa_Click(object sender, EventArgs e)
{
string s1 = b2upa.Name;
btnAction1(s1);
}
private void b2dna_Click(object sender, EventArgs e)
{
string s1 = b2dna.Name;
btnAction1(s1);
}
private void move1_Tick(object sender, EventArgs e)
{
if (NumFloor < l.Num)
{
lblupa.ForeColor = Color.Red;
for (int i = panel6.Height - NumFloor * n; i >= getfloorLength(); i--)
{
//DrawLine();
lift1.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
else
{
lbldowna.ForeColor = Color.Red;
for (int i = panel6.Height - NumFloor * n; i <= getfloorLength(); i++)
{
lift1.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
this.Focus();
System.Threading.Thread.CurrentThread.Join(1000);
NumFloor = l.Num;
lblupa.ForeColor = Color.DimGray;
lbldowna.ForeColor = Color.DimGray;
lbUpa.ForeColor = Color.DimGray;
lbDowna.ForeColor = Color.DimGray;
this.Focus();
move1.Stop();
}
private void b3a_Click(object sender, EventArgs e)
{
string s1 = b3a.Name;
btnAction1(s1);
}
private void b4a_Click(object sender, EventArgs e)
{
string s1 = b4a.Name;
btnAction1(s1);
}
private void b5a_Click(object sender, EventArgs e)
{
string s1 = b5a.Name;
btnAction1(s1);
}
private void b6a_Click(object sender, EventArgs e)
{
string s1 = b6a.Name;
btnAction1(s1);
}
private void b7a_Click(object sender, EventArgs e)
{
string s1 = b7a.Name;
btnAction1(s1);
}
private void b8a_Click(object sender, EventArgs e)
{
string s1 = b8a.Name;
btnAction1(s1);
}
private void b9a_Click(object sender, EventArgs e)
{
string s1 = b9a.Name;
btnAction1(s1);
}
private void b10a_Click(object sender, EventArgs e)
{
string s1 = b10a.Name;
btnAction1(s1);
}
private void b11a_Click(object sender, EventArgs e)
{
string s1 = b11a.Name;
btnAction1(s1);
}
private void b12a_Click(object sender, EventArgs e)
{
string s1 = b12a.Name;
btnAction1(s1);
}
private void b13a_Click(object sender, EventArgs e)
{
string s1 = b13a.Name;
btnAction1(s1);
}
private void b14a_Click(object sender, EventArgs e)
{
string s1 = b14a.Name;
btnAction1(s1);
}
private void b15a_Click(object sender, EventArgs e)
{
string s1 = b15a.Name;
btnAction1(s1);
}
private void b16a_Click(object sender, EventArgs e)
{
string s1 = b16a.Name;
btnAction1(s1);
}
private void b17a_Click(object sender, EventArgs e)
{
string s1 = b17a.Name;
btnAction1(s1);
}
private void b18a_Click(object sender, EventArgs e)
{
string s1 = b18a.Name;
btnAction1(s1);
}
private void b19a_Click(object sender, EventArgs e)
{
string s1 = b19a.Name;
btnAction1(s1);
}
private void b20a_Click(object sender, EventArgs e)
{
string s1 = b20a.Name;
btnAction1(s1);
}
private void b21a_Click(object sender, EventArgs e)
{
string s1 = b21a.Name;
btnAction1(s1);
}
private void b3upa_Click(object sender, EventArgs e)
{
string s1 = b3upa.Name;
btnAction1(s1);
}
private void b3dna_Click(object sender, EventArgs e)
{
string s1 = b3dna.Name;
btnAction1(s1);
}
private void b4upa_Click(object sender, EventArgs e)
{
string s1 = b4upa.Name;
btnAction1(s1);
}
private void b4dna_Click(object sender, EventArgs e)
{
string s1 = b4dna.Name;
btnAction1(s1);
}
private void b5upa_Click(object sender, EventArgs e)
{
string s1 = b5upa.Name;
btnAction1(s1);
}
private void b5dna_Click(object sender, EventArgs e)
{
string s1 = b5dna.Name;
btnAction1(s1);
}
private void b6upa_Click(object sender, EventArgs e)
{
string s1 = b5upa.Name;
btnAction1(s1);
}
private void b6dna_Click(object sender, EventArgs e)
{
string s1 = b6dna.Name;
btnAction1(s1);
}
private void b7upa_Click(object sender, EventArgs e)
{
string s1 = b7upa.Name;
btnAction1(s1);
}
private void b7dna_Click(object sender, EventArgs e)
{
string s1 = b7dna.Name;
btnAction1(s1);
}
private void b8upa_Click(object sender, EventArgs e)
{
string s1 = b8upa.Name;
btnAction1(s1);
}
private void b8dna_Click(object sender, EventArgs e)
{
string s1 = b8dna.Name;
btnAction1(s1);
}
private void b9udna_Click(object sender, EventArgs e)
{
string s1 = b9udna.Name;
btnAction1(s1);
}
private void b9upa_Click(object sender, EventArgs e)
{
string s1 = b9upa.Name;
btnAction1(s1);
}
private void b10upa_Click(object sender, EventArgs e)
{
string s1 = b10upa.Name;
btnAction1(s1);
}
private void b10dna_Click(object sender, EventArgs e)
{
string s1 = b10dna.Name;
btnAction1(s1);
}
private void b11upa_Click(object sender, EventArgs e)
{
string s1 = b11upa.Name;
btnAction1(s1);
}
private void b11dna_Click(object sender, EventArgs e)
{
string s1 = b11dna.Name;
btnAction1(s1);
}
private void b12upa_Click(object sender, EventArgs e)
{
string s1 = b12upa.Name;
btnAction1(s1);
}
private void b12dna_Click(object sender, EventArgs e)
{
string s1 = b12dna.Name;
btnAction1(s1);
}
private void b13upa_Click(object sender, EventArgs e)
{
string s1 = b13upa.Name;
btnAction1(s1);
}
private void b13dna_Click(object sender, EventArgs e)
{
string s1 = b13dna.Name;
btnAction1(s1);
}
private void b14upa_Click(object sender, EventArgs e)
{
string s1 = b14dna.Name;
btnAction1(s1);
}
private void b14dna_Click(object sender, EventArgs e)
{
string s1 = b14dna.Name;
btnAction1(s1);
}
private void b15upa_Click(object sender, EventArgs e)
{
string s1 = b15upa.Name;
btnAction1(s1);
}
private void b15dna_Click(object sender, EventArgs e)
{
string s1 = b15dna.Name;
btnAction1(s1);
}
private void b16upa_Click(object sender, EventArgs e)
{
string s1 = b16upa.Name;
btnAction1(s1);
}
private void b16dna_Click(object sender, EventArgs e)
{
string s1 = b16dna.Name;
btnAction1(s1);
}
private void b17upa_Click(object sender, EventArgs e)
{
string s1 = b17upa.Name;
btnAction1(s1);
}
private void b17dna_Click(object sender, EventArgs e)
{
string s1 = b17dna.Name;
btnAction1(s1);
}
private void b18upa_Click(object sender, EventArgs e)
{
string s1 = b18upa.Name;
btnAction1(s1);
}
private void b18dna_Click(object sender, EventArgs e)
{
string s1 = b18dna.Name;
btnAction1(s1);
}
private void b19upa_Click(object sender, EventArgs e)
{
string s1 = b19upa.Name;
btnAction1(s1);
}
private void b19dna_Click(object sender, EventArgs e)
{
string s1 = b19dna.Name;
btnAction1(s1);
}
private void b20upa_Click(object sender, EventArgs e)
{
string s1 = b20upa.Name;
btnAction1(s1);
}
private void b20dna_Click(object sender, EventArgs e)
{
string s1 = b20dna.Name;
btnAction1(s1);
}
private void b21upa_Click(object sender, EventArgs e)
{
string s1 = b21upa.Name;
btnAction1(s1);
}
private void b21dna_Click(object sender, EventArgs e)
{
string s1 = b21dna.Name;
btnAction1(s1);
}
private void move2_Tick(object sender, EventArgs e)
{
if (NumFloor < l.Num)
{
lblupb.ForeColor = Color.Red;
for (int i = panel9.Height - NumFloor * n; i >= getfloorLength(); i--)
{
lift2.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
else
{
lbldownb.ForeColor = Color.Red;
for (int i = panel9.Height - NumFloor * n; i <= getfloorLength(); i++)
{
lift2.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
this.Focus();
System.Threading.Thread.CurrentThread.Join(1000);
NumFloor = l.Num;
lblupb.ForeColor = Color.DimGray;
lbldownb.ForeColor = Color.DimGray;
lbUpb.ForeColor = Color.DimGray;
lbDownb.ForeColor = Color.DimGray;
this.Focus();
move2.Stop();
}
private void b1b_Click(object sender, EventArgs e)
{
string s1 = b1b.Name;
btnAction2(s1);
}
private void b2b_Click(object sender, EventArgs e)
{
string s1 = b2b.Name;
btnAction2(s1);
}
private void b3b_Click(object sender, EventArgs e)
{
string s1 = b3b.Name;
btnAction2(s1);
}
private void b4b_Click(object sender, EventArgs e)
{
string s1 = b4b.Name;
btnAction2(s1);
}
private void b5b_Click(object sender, EventArgs e)
{
string s1 = b5b.Name;
btnAction2(s1);
}
private void b6b_Click(object sender, EventArgs e)
{
string s1 = b6b.Name;
btnAction2(s1);
}
private void b7b_Click(object sender, EventArgs e)
{
string s1 = b7b.Name;
btnAction2(s1);
}
private void b8b_Click(object sender, EventArgs e)
{
string s1 = b8b.Name;
btnAction2(s1);
}
private void b9b_Click(object sender, EventArgs e)
{
string s1 = b9b.Name;
btnAction2(s1);
}
private void b10b_Click(object sender, EventArgs e)
{
string s1 = b10b.Name;
btnAction1(s1);
}
private void b11b_Click(object sender, EventArgs e)
{
string s1 = b11b.Name;
btnAction2(s1);
}
private void b12b_Click(object sender, EventArgs e)
{
string s1 = b12b.Name;
btnAction2(s1);
}
private void b13b_Click(object sender, EventArgs e)
{
string s1 = b13b.Name;
btnAction2(s1);
}
private void b14b_Click(object sender, EventArgs e)
{
string s1 = b14b.Name;
btnAction2(s1);
}
private void b15b_Click(object sender, EventArgs e)
{
string s1 = b15b.Name;
btnAction2(s1);
}
private void b16b_Click(object sender, EventArgs e)
{
string s1 = b16b.Name;
btnAction2(s1);
}
private void b17b_Click(object sender, EventArgs e)
{
string s1 = b17b.Name;
btnAction2(s1);
}
private void b18b_Click(object sender, EventArgs e)
{
string s1 = b18b.Name;
btnAction2(s1);
}
private void b19b_Click(object sender, EventArgs e)
{
string s1 = b18b.Name;
btnAction2(s1);
}
private void b20b_Click(object sender, EventArgs e)
{
string s1 = b20b.Name;
btnAction2(s1);
}
private void b21b_Click(object sender, EventArgs e)
{
string s1 = b21b.Name;
btnAction2(s1);
}
private void b1upb_Click(object sender, EventArgs e)
{
string s1 = b1upb.Name;
btnAction2(s1);
}
private void b1dnb_Click(object sender, EventArgs e)
{
string s1 = b1dnb.Name;
btnAction2(s1);
}
private void b2upb_Click(object sender, EventArgs e)
{
string s1 = b2upb.Name;
btnAction2(s1);
}
private void b2dnb_Click(object sender, EventArgs e)
{
string s1 = b2dnb.Name;
btnAction2(s1);
}
private void b3upb_Click(object sender, EventArgs e)
{
string s1 = b3upb.Name;
btnAction2(s1);
}
private void b3dnb_Click(object sender, EventArgs e)
{
string s1 = b3dnb.Name;
btnAction2(s1);
}
private void b4upb_Click(object sender, EventArgs e)
{
string s1 = b4upb.Name;
btnAction2(s1);
}
private void b4dnb_Click(object sender, EventArgs e)
{
string s1 = b4dnb.Name;
btnAction2(s1);
}
private void b5upb_Click(object sender, EventArgs e)
{
string s1 = b5upb.Name;
btnAction2(s1);
}
private void b5dnb_Click(object sender, EventArgs e)
{
string s1 = b5dnb.Name;
btnAction2(s1);
}
private void b6upb_Click(object sender, EventArgs e)
{
string s1 = b6dnb.Name;
btnAction2(s1);
}
private void b6dnb_Click(object sender, EventArgs e)
{
string s1 = b6dnb.Name;
btnAction2(s1);
}
private void b7upb_Click(object sender, EventArgs e)
{
string s1 = b7upb.Name;
btnAction2(s1);
}
private void b7dnb_Click(object sender, EventArgs e)
{
string s1 = b7dnb.Name;
btnAction2(s1);
}
private void b8upb_Click(object sender, EventArgs e)
{
string s1 = b8upb.Name;
btnAction2(s1);
}
private void b8dnb_Click(object sender, EventArgs e)
{
string s1 = b8dnb.Name;
btnAction2(s1);
}
private void b9upb_Click(object sender, EventArgs e)
{
string s1 = b9upb.Name;
btnAction2(s1);
}
private void b9dnb_Click(object sender, EventArgs e)
{
string s1 = b9dnb.Name;
btnAction2(s1);
}
private void b10upb_Click(object sender, EventArgs e)
{
string s1 = b10upb.Name;
btnAction2(s1);
}
private void b10dnb_Click(object sender, EventArgs e)
{
string s1 = b10dnb.Name;
btnAction2(s1);
}
private void b11upb_Click(object sender, EventArgs e)
{
string s1 = b11upb.Name;
btnAction2(s1);
}
private void b11dnb_Click(object sender, EventArgs e)
{
string s1 = b11dnb.Name;
btnAction2(s1);
}
private void b12upb_Click(object sender, EventArgs e)
{
string s1 = b12upb.Name;
btnAction2(s1);
}
private void b12dnb_Click(object sender, EventArgs e)
{
string s1 = b12dnb.Name;
btnAction2(s1);
}
private void b13upb_Click(object sender, EventArgs e)
{
string s1 = b13upb.Name;
btnAction2(s1);
}
private void b13dnb_Click(object sender, EventArgs e)
{
string s1 = b13dnb.Name;
btnAction2(s1);
}
private void b14upb_Click(object sender, EventArgs e)
{
string s1 = b14upb.Name;
btnAction2(s1);
}
private void b14dnb_Click(object sender, EventArgs e)
{
string s1 = b14dnb.Name;
btnAction2(s1);
}
private void b15upb_Click(object sender, EventArgs e)
{
string s1 = b15upb.Name;
btnAction2(s1);
}
private void b15dnb_Click(object sender, EventArgs e)
{
string s1 = b15dnb.Name;
btnAction2(s1);
}
private void b16upb_Click(object sender, EventArgs e)
{
string s1 = b16upb.Name;
btnAction2(s1);
}
private void b16dnb_Click(object sender, EventArgs e)
{
string s1 = b16dnb.Name;
btnAction2(s1);
}
private void b17upb_Click(object sender, EventArgs e)
{
string s1 = b17upb.Name;
btnAction2(s1);
}
private void b17dnb_Click(object sender, EventArgs e)
{
string s1 = b17dnb.Name;
btnAction2(s1);
}
private void b18upb_Click(object sender, EventArgs e)
{
string s1 = b18upb.Name;
btnAction2(s1);
}
private void b18dnb_Click(object sender, EventArgs e)
{
string s1 = b18dnb.Name;
btnAction2(s1);
}
private void b19upb_Click(object sender, EventArgs e)
{
string s1 = b19upb.Name;
btnAction2(s1);
}
private void b19dnb_Click(object sender, EventArgs e)
{
string s1 = b19dnb.Name;
btnAction2(s1);
}
private void b20upb_Click(object sender, EventArgs e)
{
string s1 = b20upb.Name;
btnAction2(s1);
}
private void b20dnb_Click(object sender, EventArgs e)
{
string s1 = b20dnb.Name;
btnAction2(s1);
}
private void b21upb_Click(object sender, EventArgs e)
{
string s1 = b21upb.Name;
btnAction2(s1);
}
private void b21dnb_Click(object sender, EventArgs e)
{
string s1 = b21dnb.Name;
btnAction2(s1);
}
private void move3_Tick(object sender, EventArgs e)
{
if (NumFloor < l.Num)
{
lblupc.ForeColor = Color.Red;
for (int i = panel12.Height - NumFloor * n; i >= getfloorLength(); i--)
{
lift3.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
else
{
lbldownc.ForeColor = Color.Red;
for (int i = panel12.Height - NumFloor * n; i <= getfloorLength(); i++)
{
lift3.Location = new Point(3, i);
System.Threading.Thread.CurrentThread.Join(10);
}
}
this.Focus();
System.Threading.Thread.CurrentThread.Join(1000);
NumFloor = l.Num;
lblupc.ForeColor = Color.DimGray;
lbldownc.ForeColor = Color.DimGray;
lbUpc.ForeColor = Color.DimGray;
lbDownc.ForeColor = Color.DimGray;
this.Focus();
move3.Stop();
}
private void b1c_Click(object sender, EventArgs e)
{
string s1 = b1c.Name;
btnAction3(s1);
}
private void b2c_Click(object sender, EventArgs e)
{
string s1 = b2c.Name;
btnAction3(s1);
}
private void b3c_Click(object sender, EventArgs e)
{
string s1 = b3c.Name;
btnAction3(s1);
}
private void b4c_Click(object sender, EventArgs e)
{
string s1 = b4c.Name;
btnAction3(s1);
}
private void b5c_Click(object sender, EventArgs e)
{
string s1 = b5c.Name;
btnAction3(s1);
}
private void b6c_Click(object sender, EventArgs e)
{
string s1 = b6c.Name;
btnAction3(s1);
}
private void b7c_Click(object sender, EventArgs e)
{
string s1 = b7c.Name;
btnAction3(s1);
}
private void b8c_Click(object sender, EventArgs e)
{
string s1 = b8c.Name;
btnAction3(s1);
}
private void b9c_Click(object sender, EventArgs e)
{
string s1 = b9c.Name;
btnAction3(s1);
}
private void b10c_Click(object sender, EventArgs e)
{
string s1 = b10c.Name;
btnAction3(s1);
}
private void b11c_Click(object sender, EventArgs e)
{
string s1 = b11c.Name;
btnAction3(s1);
}
private void b12c_Click(object sender, EventArgs e)
{
string s1 = b12c.Name;
btnAction3(s1);
}
private void b13c_Click(object sender, EventArgs e)
{
string s1 = b13c.Name;
btnAction3(s1);
}
private void b14c_Click(object sender, EventArgs e)
{
string s1 = b14c.Name;
btnAction3(s1);
}
private void b15c_Click(object sender, EventArgs e)
{
string s1 = b15c.Name;
btnAction3(s1);
}
private void b16c_Click(object sender, EventArgs e)
{
string s1 = b16c.Name;
btnAction3(s1);
}
private void b17c_Click(object sender, EventArgs e)
{
string s1 = b17c.Name;
btnAction3(s1);
}
private void b18c_Click(object sender, EventArgs e)
{
string s1 = b18c.Name;
btnAction3(s1);
}
private void b19c_Click(object sender, EventArgs e)
{
string s1 = b19c.Name;
btnAction3(s1);
}
private void b20c_Click(object sender, EventArgs e)
{
string s1 = b20c.Name;
btnAction3(s1);
}
private void b21c_Click(object sender, EventArgs e)
{
string s1 = b21c.Name;
btnAction3(s1);
}
private void b1upc_Click(object sender, EventArgs e)
{
string s1 = b1upc.Name;
btnAction3(s1);
}
private void b1dnc_Click(object sender, EventArgs e)
{
string s1 = b1dnc.Name;
btnAction3(s1);
}
private void b2upc_Click(object sender, EventArgs e)
{
string s1 = b2upc.Name;
btnAction3(s1);
}
private void b2dnc_Click(object sender, EventArgs e)
{
string s1 = b2dnc.Name;
btnAction3(s1);
}
private void b3upc_Click(object sender, EventArgs e)
{
string s1 = b3upc.Name;
btnAction3(s1);
}
private void b4upc_Click(object sender, EventArgs e)
{
string s1 = b4upc.Name;
btnAction3(s1);
}
private void b4dnc_Click(object sender, EventArgs e)
{
string s1 = b4dnc.Name;
btnAction3(s1);
}
private void b5upc_Click(object sender, EventArgs e)
{
string s1 = b5upc.Name;
btnAction3(s1);
}
private void b5dnc_Click(object sender, EventArgs e)
{
string s1 = b5dnc.Name;
btnAction3(s1);
}
private void b6upc_Click(object sender, EventArgs e)
{
string s1 = b6upc.Name;
btnAction3(s1);
}
private void b6dnc_Click(object sender, EventArgs e)
{
string s1 = b6dnc.Name;
btnAction3(s1);
}
private void b7upc_Click(object sender, EventArgs e)
{
string s1 = b7upc.Name;
btnAction3(s1);
}
private void b7dnc_Click(object sender, EventArgs e)
{
string s1 = b7dnc.Name;
btnAction3(s1);
}
private void b8upc_Click(object sender, EventArgs e)
{
string s1 = b8upc.Name;
btnAction3(s1);
}
private void b8dnc_Click(object sender, EventArgs e)
{
string s1 = b8dnc.Name;
btnAction3(s1);
}
private void b9upc_Click(object sender, EventArgs e)
{
string s1 = b9upc.Name;
btnAction3(s1);
}
private void b9dnc_Click(object sender, EventArgs e)
{
string s1 = b9dnc.Name;
btnAction3(s1);
}
private void b10upc_Click(object sender, EventArgs e)
{
string s1 = b10upc.Name;
btnAction3(s1);
}
private void b10dnc_Click(object sender, EventArgs e)
{
string s1 = b10dnc.Name;
btnAction3(s1);
}
private void b11upc_Click(object sender, EventArgs e)
{
string s1 = b11upc.Name;
btnAction3(s1);
}
private void b11dnc_Click(object sender, EventArgs e)
{
string s1 = b11dnc.Name;
btnAction3(s1);
}
private void b12upc_Click(object sender, EventArgs e)
{
string s1 = b12upc.Name;
btnAction3(s1);
}
private void b12dnc_Click(object sender, EventArgs e)
{
string s1 = b12dnc.Name;
btnAction3(s1);
}
private void b13upc_Click(object sender, EventArgs e)
{
string s1 = b13upc.Name;
btnAction3(s1);
}
private void b13dnc_Click(object sender, EventArgs e)
{
string s1 = b13dnc.Name;
btnAction3(s1);
}
private void b14upc_Click(object sender, EventArgs e)
{
string s1 = b14upc.Name;
btnAction3(s1);
}
private void b14dnc_Click(object sender, EventArgs e)
{
string s1 = b14dnc.Name;
btnAction3(s1);
}
private void b15upc_Click(object sender, EventArgs e)
{
string s1 = b15upc.Name;
btnAction3(s1);
}
private void b15dnc_Click(object sender, EventArgs e)
{
string s1 = b15dnc.Name;
btnAction3(s1);
}
private void b16upc_Click(object sender, EventArgs e)
{
string s1 = b16upc.Name;
btnAction3(s1);
}
private void b16dnc_Click(object sender, EventArgs e)
{
string s1 = b16dnc.Name;
btnAction3(s1);
}
private void b17upc_Click(object sender, EventArgs e)
{
string s1 = b17upc.Name;
btnAction3(s1);
}
private void b17dnc_Click(object sender, EventArgs e)
{
string s1 = b17dnc.Name;
btnAction3(s1);
}
private void b18pc_Click(object sender, EventArgs e)
{
string s1 = b18pc.Name;
btnAction3(s1);
}
private void b18dnc_Click(object sender, EventArgs e)
{
string s1 = b18dnc.Name;
btnAction3(s1);
}
private void b19upc_Click(object sender, EventArgs e)
{
string s1 = b19upc.Name;
btnAction3(s1);
}
private void b19dnc_Click(object sender, EventArgs e)
{
string s1 = b19dnc.Name;
btnAction3(s1);
}
private void b20pc_Click(object sender, EventArgs e)
{
string s1 = b20pc.Name;
btnAction3(s1);
}
private void b20dnc_Click(object sender, EventArgs e)
{
string s1 = b20dnc.Name;
btnAction3(s1);
}
private void b21upc_Click(object sender, EventArgs e)
{
string s1 = b21upc.Name;
btnAction3(s1);
}
private void b21dnc_Click(object sender, EventArgs e)
{
string s1 = b21dnc.Name;
btnAction3(s1);
}
}
}
实验截图如下:
程序思想:
首先是界面设置,有电梯框架panle,还有控制电梯升将的panle,最主
要有两个函数,move和butAction,通过这两个函数的调用实现对电梯上下
调度的控制,主要就是按钮的触发时间的改动太繁琐,一个电梯完成后其他
电梯的按钮都得一一改变,总之,基本算是完成了电梯的调度。