• 大小: 246KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-05
  • 语言: C#
  • 标签: C#  

资源简介

C#模拟电梯控制,有源码,清楚易懂,实用。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//Download by http://www.codefans.net
namespace lift
{
    public partial class Form1 : Form
    {
        int destion = 0;//目的楼层
        int number = 0;//所到楼层
        public Form1()
        {
            InitializeComponent();
            //this.skinEngine1.SkinFile = “Vista2_color5.ssk“;
        }

        private void button21_Click(object sender EventArgs e)
        {
            if (destion == 0)
            {
                lblWarming.Visible = true;
            }
            else
            {
                tmrSeconds.Start();
            }
            
        }

        private void lift_click(object sender EventArgs e)
        {
            if (destion == 0)
            {
                destion = Convert.ToInt32(((Button)sender).Tag);
                ((Button)sender).BackColor = Color.Red;
            }
            else
            {
                MessageBox.Show(“你只能选择一个楼层““提示“MessageBoxButtons.OKMessageBoxIcon.Information);
            }
        }

        private void FormmoveUp()
        {
            bool x = false;
            bool y = true;
            if (x == false && y == true)
            {
                this.Top-=30;
                if (this.Top==-319)
                {
                    this.Top = 450;
                }
            }
        }

        private void FormmoveDown()
        {
            bool x = false;
            bool y = true;
            if (x == false && y == true)
            {
                this.Top+=30;
                if(this.Top==780)
                {
                    this.Top = 0;
                }
            }
        }

        private void tmrSeconds_Tick(object sender EventArgs e)
        {
           
            if (number < destion)
            {
                FormmoveUp();
                number++;   
                foreach (Control item in this.Controls)
                {
                    if (item is Button)
                    {
                        if(number<=destion)
                        {
                            item.BackColor = Color.LightGray;
                        }
                        int index = Convert.ToInt32(item.Tag);
                        if (index == number)
                        {
                            item.BackColor = Color.Green;
                        }
                    }
                }
                lblPostion.Text = number.ToString();
            } 
            else if(number>destion)
            {
                FormmoveDown();
                number--;
                foreach (Control item in this.Controls)
                {
                    if (item is Button)
                    {
                        if (number >= destion)
                        {
        

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        901  2008-12-18 19:49  C#模拟电梯控制\lift.sln

    ..A..H.     17920  2009-08-06 12:19  C#模拟电梯控制\lift.suo

     文件       4227  2009-07-01 07:38  C#模拟电梯控制\lift\Form1.cs

     文件      20177  2009-06-14 18:24  C#模拟电梯控制\lift\Form1.Designer.cs

     文件      51403  2009-06-14 18:24  C#模拟电梯控制\lift\Form1.resx

     文件       4448  2009-06-14 15:49  C#模拟电梯控制\lift\lift.csproj

     文件      29926  2009-06-14 15:49  C#模拟电梯控制\lift\Mac OS X Modern Icon 13.ico

     文件        500  2009-07-01 07:38  C#模拟电梯控制\lift\Program.cs

     文件       2774  2008-12-19 21:26  C#模拟电梯控制\lift\Resources\1.bmp

     文件       1228  2009-07-01 07:38  C#模拟电梯控制\lift\Properties\AssemblyInfo.cs

     文件       3109  2009-07-01 07:38  C#模拟电梯控制\lift\Properties\Resources.Designer.cs

     文件       6189  2008-12-19 21:26  C#模拟电梯控制\lift\Properties\Resources.resx

     文件       1087  2008-12-18 19:49  C#模拟电梯控制\lift\Properties\Settings.Designer.cs

     文件        249  2008-12-18 19:49  C#模拟电梯控制\lift\Properties\Settings.settings

     文件     516096  2006-08-18 11:50  C#模拟电梯控制\lift\bin\Debug\IrisSkin2.dll

     文件      15821  2006-07-18 23:12  C#模拟电梯控制\lift\bin\Debug\Vista2_color5.ssk

     文件       5632  2005-12-08 14:51  C#模拟电梯控制\lift\bin\Debug\lift.vshost.exe

     文件      90112  2009-08-06 11:29  C#模拟电梯控制\lift\bin\Debug\lift.exe

     文件      30208  2009-08-06 11:29  C#模拟电梯控制\lift\bin\Debug\lift.pdb

     文件        496  2009-07-29 17:23  C#模拟电梯控制\lift\obj\Debug\lift.csproj.ResolveComReference.cache

     文件      30492  2009-08-06 11:29  C#模拟电梯控制\lift\obj\Debug\lift.Form1.resources

     文件       3236  2009-08-06 11:29  C#模拟电梯控制\lift\obj\Debug\lift.Properties.Resources.resources

     文件        877  2009-07-29 17:23  C#模拟电梯控制\lift\obj\Debug\lift.csproj.GenerateResource.Cache

     文件      30208  2009-08-06 11:29  C#模拟电梯控制\lift\obj\Debug\lift.pdb

     文件      90112  2009-08-06 11:29  C#模拟电梯控制\lift\obj\Debug\lift.exe

     文件      24155  2009-08-06 11:29  C#模拟电梯控制\lift\obj\Debug\ResolveAssemblyReference.cache

     文件        296  2009-08-06 11:50  C#模拟电梯控制\lift\obj\lift.csproj.FileList.txt

     目录          0  2009-07-29 17:23  C#模拟电梯控制\lift\obj\Debug\TempPE

     目录          0  2009-07-29 16:51  C#模拟电梯控制\lift\bin\Debug

     目录          0  2009-07-29 17:23  C#模拟电梯控制\lift\obj\Debug

............此处省略9个文件信息

评论

共有 条评论