📄 frmtravelplan.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace PlanTheTravel
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmTravelPlan : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.TextBox txtDest;
private System.Windows.Forms.ListBox lstTrainDet;
private System.Windows.Forms.Label lblDestination;
private System.Windows.Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frmTravelPlan()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <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.btnSearch = new System.Windows.Forms.Button();
this.lblDestination = new System.Windows.Forms.Label();
this.txtDest = new System.Windows.Forms.TextBox();
this.lstTrainDet = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnSearch
//
this.btnSearch.Location = new System.Drawing.Point(320, 8);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(86, 24);
this.btnSearch.TabIndex = 0;
this.btnSearch.Text = "搜索(&S)";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// lblDestination
//
this.lblDestination.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblDestination.ForeColor = System.Drawing.SystemColors.ControlText;
this.lblDestination.Location = new System.Drawing.Point(8, 16);
this.lblDestination.Name = "lblDestination";
this.lblDestination.Size = new System.Drawing.Size(56, 16);
this.lblDestination.TabIndex = 1;
this.lblDestination.Text = "终点站:";
//
// txtDest
//
this.txtDest.Location = new System.Drawing.Point(72, 8);
this.txtDest.Name = "txtDest";
this.txtDest.Size = new System.Drawing.Size(240, 21);
this.txtDest.TabIndex = 2;
this.txtDest.Text = "";
//
// lstTrainDet
//
this.lstTrainDet.ItemHeight = 12;
this.lstTrainDet.Location = new System.Drawing.Point(8, 40);
this.lstTrainDet.Name = "lstTrainDet";
this.lstTrainDet.Size = new System.Drawing.Size(400, 160);
this.lstTrainDet.TabIndex = 3;
this.lstTrainDet.SelectedIndexChanged += new System.EventHandler(this.lstTrainDet_SelectedIndexChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(320, 208);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(86, 24);
this.button1.TabIndex = 4;
this.button1.Text = "退出(&E)";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// frmTravelPlan
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(416, 243);
this.Controls.Add(this.button1);
this.Controls.Add(this.lstTrainDet);
this.Controls.Add(this.txtDest);
this.Controls.Add(this.btnSearch);
this.Controls.Add(this.lblDestination);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmTravelPlan";
this.Text = "旅行计划";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmTravelPlan());
}
private void btnSearch_Click(object sender, System.EventArgs e)
{
this.lstTrainDet.Items.Add("T1: 湖南 - "+this.txtDest.Text);
this.lstTrainDet.Items.Add("T6: 南昌 - "+this.txtDest.Text);
this.lstTrainDet.Items.Add("289 : 宜昌 - "+this.txtDest.Text);
this.lstTrainDet.Items.Add("331: 郑州 - "+this.txtDest.Text);
this.lstTrainDet.Items.Add("356: 广安 - "+this.txtDest.Text);
this.lstTrainDet.Items.Add("K89 : 天水 - "+this.txtDest.Text);
this.btnSearch.Enabled = false;
}
private void lstTrainDet_SelectedIndexChanged(object sender, System.EventArgs e)
{
frmPassDetails objFrmPass = new frmPassDetails(this.txtDest.Text);
objFrmPass.Show();
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -