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

📄 frmpassdetails.cs

📁 yongle jpscxsd j cxksk xdkl sna
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace PlanTheTravel
{
	/// <summary>
	/// Summary description for frmPassDetails.
	/// </summary>
	public class frmPassDetails : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label lblName;
		private System.Windows.Forms.Label lblSex;
		private System.Windows.Forms.Label lblOrigin;
		private System.Windows.Forms.Label lblDest;
		private System.Windows.Forms.Label lblDOT;
		private System.Windows.Forms.Label lblDD;
		private System.Windows.Forms.Label lblMM;
		private System.Windows.Forms.Label lblYY;
		private System.Windows.Forms.Button btnSend;
		private System.Windows.Forms.TextBox txtName;
		private System.Windows.Forms.ComboBox cboSex;
		private System.Windows.Forms.ComboBox cboOrigin;
		private System.Windows.Forms.ComboBox cboDD;
		private System.Windows.Forms.ComboBox cboMM;
		private System.Windows.Forms.TextBox txtYYYY;
		private System.Windows.Forms.TextBox txtDest;
		private System.Windows.Forms.Button Exit;
		private System.Windows.Forms.GroupBox groupBox1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmPassDetails(string destination)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			this.txtDest.Text = destination;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.lblName = new System.Windows.Forms.Label();
			this.lblSex = new System.Windows.Forms.Label();
			this.lblOrigin = new System.Windows.Forms.Label();
			this.lblDest = new System.Windows.Forms.Label();
			this.lblDOT = new System.Windows.Forms.Label();
			this.lblDD = new System.Windows.Forms.Label();
			this.lblMM = new System.Windows.Forms.Label();
			this.lblYY = new System.Windows.Forms.Label();
			this.btnSend = new System.Windows.Forms.Button();
			this.txtName = new System.Windows.Forms.TextBox();
			this.txtDest = new System.Windows.Forms.TextBox();
			this.cboSex = new System.Windows.Forms.ComboBox();
			this.cboOrigin = new System.Windows.Forms.ComboBox();
			this.cboDD = new System.Windows.Forms.ComboBox();
			this.cboMM = new System.Windows.Forms.ComboBox();
			this.txtYYYY = new System.Windows.Forms.TextBox();
			this.Exit = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.SuspendLayout();
			// 
			// lblName
			// 
			this.lblName.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblName.Location = new System.Drawing.Point(8, 8);
			this.lblName.Name = "lblName";
			this.lblName.Size = new System.Drawing.Size(57, 25);
			this.lblName.TabIndex = 0;
			this.lblName.Text = "姓名";
			this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblSex
			// 
			this.lblSex.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblSex.Location = new System.Drawing.Point(8, 40);
			this.lblSex.Name = "lblSex";
			this.lblSex.Size = new System.Drawing.Size(58, 17);
			this.lblSex.TabIndex = 0;
			this.lblSex.Text = "性别";
			this.lblSex.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblOrigin
			// 
			this.lblOrigin.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblOrigin.Location = new System.Drawing.Point(8, 64);
			this.lblOrigin.Name = "lblOrigin";
			this.lblOrigin.Size = new System.Drawing.Size(96, 17);
			this.lblOrigin.TabIndex = 0;
			this.lblOrigin.Text = "起点站";
			this.lblOrigin.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.lblOrigin.Click += new System.EventHandler(this.label1_Click);
			// 
			// lblDest
			// 
			this.lblDest.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblDest.Location = new System.Drawing.Point(8, 88);
			this.lblDest.Name = "lblDest";
			this.lblDest.Size = new System.Drawing.Size(96, 17);
			this.lblDest.TabIndex = 0;
			this.lblDest.Text = "终点站";
			this.lblDest.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblDOT
			// 
			this.lblDOT.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblDOT.Location = new System.Drawing.Point(8, 112);
			this.lblDOT.Name = "lblDOT";
			this.lblDOT.Size = new System.Drawing.Size(80, 25);
			this.lblDOT.TabIndex = 0;
			this.lblDOT.Text = "旅行日期";
			this.lblDOT.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblDD
			// 
			this.lblDD.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblDD.Location = new System.Drawing.Point(440, 112);
			this.lblDD.Name = "lblDD";
			this.lblDD.Size = new System.Drawing.Size(20, 18);
			this.lblDD.TabIndex = 0;
			this.lblDD.Text = "日";
			this.lblDD.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblMM
			// 
			this.lblMM.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblMM.Location = new System.Drawing.Point(336, 112);
			this.lblMM.Name = "lblMM";
			this.lblMM.Size = new System.Drawing.Size(20, 18);
			this.lblMM.TabIndex = 0;
			this.lblMM.Text = "月";
			this.lblMM.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblYY
			// 
			this.lblYY.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblYY.Location = new System.Drawing.Point(240, 112);
			this.lblYY.Name = "lblYY";
			this.lblYY.Size = new System.Drawing.Size(20, 18);
			this.lblYY.TabIndex = 0;
			this.lblYY.Text = "年";
			this.lblYY.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// btnSend
			// 
			this.btnSend.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSend.Location = new System.Drawing.Point(288, 152);
			this.btnSend.Name = "btnSend";
			this.btnSend.Size = new System.Drawing.Size(75, 24);
			this.btnSend.TabIndex = 1;
			this.btnSend.Text = "发送(&S)";
			this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
			// 
			// txtName
			// 
			this.txtName.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtName.Location = new System.Drawing.Point(104, 16);
			this.txtName.Name = "txtName";
			this.txtName.Size = new System.Drawing.Size(136, 21);
			this.txtName.TabIndex = 2;
			this.txtName.Text = "";
			// 
			// txtDest
			// 
			this.txtDest.Enabled = false;
			this.txtDest.Location = new System.Drawing.Point(104, 88);
			this.txtDest.Name = "txtDest";
			this.txtDest.Size = new System.Drawing.Size(136, 21);
			this.txtDest.TabIndex = 2;
			this.txtDest.Text = "";
			// 
			// cboSex
			// 
			this.cboSex.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboSex.Location = new System.Drawing.Point(104, 40);
			this.cboSex.Name = "cboSex";
			this.cboSex.Size = new System.Drawing.Size(136, 20);
			this.cboSex.TabIndex = 3;
			// 
			// cboOrigin
			// 
			this.cboOrigin.Location = new System.Drawing.Point(104, 64);
			this.cboOrigin.Name = "cboOrigin";
			this.cboOrigin.Size = new System.Drawing.Size(136, 20);
			this.cboOrigin.TabIndex = 3;
			// 
			// cboDD
			// 
			this.cboDD.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboDD.Location = new System.Drawing.Point(368, 112);
			this.cboDD.Name = "cboDD";
			this.cboDD.Size = new System.Drawing.Size(67, 20);
			this.cboDD.TabIndex = 3;
			// 
			// cboMM
			// 
			this.cboMM.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboMM.Location = new System.Drawing.Point(264, 112);
			this.cboMM.Name = "cboMM";
			this.cboMM.Size = new System.Drawing.Size(67, 20);
			this.cboMM.TabIndex = 3;
			// 
			// txtYYYY
			// 
			this.txtYYYY.Location = new System.Drawing.Point(104, 112);
			this.txtYYYY.Name = "txtYYYY";
			this.txtYYYY.Size = new System.Drawing.Size(136, 21);
			this.txtYYYY.TabIndex = 2;
			this.txtYYYY.Text = "";
			this.txtYYYY.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtYYYY_KeyPress);
			// 
			// Exit
			// 
			this.Exit.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Exit.Location = new System.Drawing.Point(376, 152);
			this.Exit.Name = "Exit";
			this.Exit.Size = new System.Drawing.Size(75, 24);
			this.Exit.TabIndex = 1;
			this.Exit.Text = "关闭(&C)";
			this.Exit.Click += new System.EventHandler(this.Exit_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Location = new System.Drawing.Point(8, 136);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(448, 8);
			this.groupBox1.TabIndex = 4;
			this.groupBox1.TabStop = false;
			// 
			// frmPassDetails
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(464, 189);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.cboSex);
			this.Controls.Add(this.txtName);
			this.Controls.Add(this.btnSend);
			this.Controls.Add(this.lblName);
			this.Controls.Add(this.lblSex);
			this.Controls.Add(this.lblOrigin);
			this.Controls.Add(this.lblDest);
			this.Controls.Add(this.lblDOT);
			this.Controls.Add(this.lblDD);
			this.Controls.Add(this.lblMM);
			this.Controls.Add(this.lblYY);
			this.Controls.Add(this.txtDest);
			this.Controls.Add(this.cboOrigin);
			this.Controls.Add(this.cboDD);
			this.Controls.Add(this.cboMM);
			this.Controls.Add(this.txtYYYY);
			this.Controls.Add(this.Exit);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
			this.MaximizeBox = false;
			this.Name = "frmPassDetails";
			this.Text = "旅客详细资料";
			this.Load += new System.EventHandler(this.frmPassDetails_Load);
			this.ResumeLayout(false);

		}
		#endregion

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

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

			// Populating values in the Sex Combo Box
			this.cboSex.Items.Add("男性");
			this.cboSex.Items.Add("女性");
			this.cboSex.Text = "男性";
			
			// Populating values in the Origin Combo Box
			Object[] objOrigin = new Object[]{"湖南","南昌","宜昌","广汉","天水","兰州",this.txtDest.Text};
			this.cboOrigin.Items.AddRange(objOrigin);
			this.cboOrigin.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cboOrigin.Text=objOrigin[0].ToString();
			
			// Populating values in the DD combo box
			for (int day = 1; day <= 31; day++)
				this.cboDD.Items.Add(day);
			this.cboDD.Text = "1";

			// Populating values in the MM combo box
			for (int month = 1; month <= 12; month++)
				this.cboMM.Items.Add(month);
			this.cboMM.Text = "1";
			
		}

		private void Exit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void btnSend_Click(object sender, System.EventArgs e)
		{
			MessageBox.Show("恭喜!您的旅客编号为 PN129089","确认");
		}

		private void txtYYYY_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if(!(Char.IsDigit(e.KeyChar)))
			{
				MessageBox.Show("Enter only Numbers");
				e.Handled=true;
			}

		}
	}
}

⌨️ 快捷键说明

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