⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.cs

📁 主要用C#写的代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
		private void lbl45_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl45.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl45.Text;
			}
		}

		private void lbl37_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl37.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl37.Text;
			}
		}

		private void lbl49_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl49.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl49.Text;
			}
		}

		private void lbl4_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl4.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl4.Text;
			}
		}

		private void lbl26_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl26.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl26.Text;
			}
		}

		private void lbl22_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl22.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl22.Text;
			}
		}

		private void lbl38_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl38.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl38.Text;
			}
		}

		private void lbl14_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl14.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl14.Text;
			}
		}

		private void lbl42_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl42.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl42.Text;
			}
		}

		private void lbl21_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl21.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl21.Text;
			}
		}

		private void lbl9_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl9.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl9.Text;
			}
		}

		private void lbl12_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl12.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl12.Text;
			}
		}

		private void lbl33_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl33.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl33.Text;
			}
		}

		private void lbl34_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl34.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl34.Text;
			}
		}

		private void lbl35_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl35.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl35.Text;
			}
		}

		private void lbl1_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl1.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl1.Text;
			}
		}

		private void lbl44_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl44.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl44.Text;
			}
		}

		private void lbl5_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl5.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl5.Text;
			}
		}

		private void lbl24_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl24.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl24.Text;
			}
		}

		private void lbl47_Click(object sender, System.EventArgs e)
		{
			//判断
			if(this.txtGo.Focused)
			{
				this.txtGo.Text=this.lbl47.Text;
			}
			else
			{
				this.txtSdop.Text=this.lbl47.Text;
			}
		}
        /// <summary>
        /// 退出单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void bntTuiChu_Click(object sender, System.EventArgs e)
		{
			//显示提示框
			MessageBox.Show("欢迎您使用网上订票系统!您没有在该系统上订购火车票!谢谢您的支持和使用。欢迎下次光临!!!!!!");
			//退出该界面
		    //Application.Exit();
			//隐藏该界面
			this.Visible=false;
			//返回上一个界面
			Form1 f=new Form1();
			f.Show();
		}
        /// <summary>
        /// 购买火车票的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void bntGouMai_Click(object sender, System.EventArgs e)
		{
			
			if(txtGo.Text.Trim().Equals(""))
			{
                 MessageBox.Show("您选择的火车站不能为空!!!请输入火车站!!!","提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
				return;
			}
			if(txtSdop.Text.Trim().Equals(""))
			{
                 MessageBox.Show("您选择的火车站不能为空!!!请输入火车站!!!","提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
				return;
			}
			//隐藏当前窗体
			//this.Hide();
			//this.Visible=false;
			
		}

		//获得中转站数组
		public static ArrayList arr = new ArrayList();

		DataSet ds = new DataSet();

		int flag = 0;

		private void timer1_Tick(object sender, System.EventArgs e)
		{
			progressBar1.Value = progressBar1.Value+10;
			if(progressBar1.Value==100)
			{
				this.timer1.Stop();

				//获得起始站
				string go=this.txtGo.Text;
				//获得终点站
				string sdop=this.txtSdop.Text;

				if(this.comZhongZhuan.Items.Count!=0)  //没有直达车
				{
					string zhongzhuan = this.comZhongZhuan.Items[0].ToString();
					ds = scheduleaccess.GetCityName(go,zhongzhuan,sdop);
					
					flag = 1;
				}
				else  //有直达车
				{
					//封装传过来的车次信息
					schedule.Tocity=sdop;
					schedule.Fromcity=go;
					//调用业务逻辑层的车次业务处理方法
					ds = scheduleaccess.GetScheInfoByCity(schedule);

					flag = 0;
				}
//		 TrainBussiness1 trainbussiness1=new TrainBussiness1(go,to);
			
				
				//在DataGridView中显示查询的结果
				//ChaXunForm chaxun=new ChaXunForm();
				ChaXunForm chaxun=new ChaXunForm(ds,go,sdop,flag);
				//判断是否查找到相关的车次信息
				
				chaxun.Show();

				

				//隐藏上一个界面
				//this.Visible=false;
			}
			

		}

		private void txtGo_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void progressBar1_Click(object sender, System.EventArgs e)
		{
		
		}

		/// <summary>
		/// 获得中转站
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void comZhongZhuan_Click(object sender, System.EventArgs e)
		{
			int n = arr.Count;
			
//			int n = this.strArr.Length;
			MessageBox.Show("个数:"+n);
//			foreach(string cityname in strArr)
//			{
//				this.comZhongZhuan.Items.Add(cityname);
//			}

			for(int i=0;i<n;++i)
			{
				this.comZhongZhuan.Items.Add(arr[i].ToString());
			}
			this.comZhongZhuan.DroppedDown = true;
			//this.
		}

		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -