东北大学秦皇岛分校 C#列车时刻表 大作业_第1页
东北大学秦皇岛分校 C#列车时刻表 大作业_第2页
东北大学秦皇岛分校 C#列车时刻表 大作业_第3页
东北大学秦皇岛分校 C#列车时刻表 大作业_第4页
东北大学秦皇岛分校 C#列车时刻表 大作业_第5页
已阅读5页,还剩4页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、c#程序设计实验报告列车时刻查询表学 号:2133320姓 名:许晓明提交日期:2015.12.28成 绩:东北大学秦皇岛分校C#课程设计 一实验背景:现在人们的出行需求越来越大,无论是逢年过节回家探亲还是节假日短途旅游。汽车速度太慢,内部空间狭窄,舒适度不高,飞机价钱高昂,不是一般人都能做得起,所以火车出行成为了越来越多的人的不二之选。而且随着我国大力发展高铁事业,扩充铁路分布覆盖,列车车次信息急剧增多,列车查询表将会给我们的生活带来更多的便捷。二实验目的: 实现一个列车时刻查询表,我主要做了以下几个模块:界面设计,web数据库连接,填写作者信息,界面美化。1. 界面设计:构建大致的界面布局

2、,做到简洁、明了,方便用户的使用,具有实用性。2. web数据库连接:从网上找数据资料,确保资料的正确性、及时更新性等,是整个查询表的核心部分。3. 作者信息:填写自己的相关信息,让使用者更了解软件。4. 界面美化:由书上所学知识,确定框架大小无法被随意改动,启动时自动居中,更换主题背景颜色,更换icon。通过对以上各个模块的功能实现,以达到列车时刻查询表的目的。本系统使用c#语言编写,编程工具为visual studio 2015pro,编程使用的系统环境为windows 10 x64多语言版。三实验步骤: 1.程序框图及程序说明:(1).框图如下:主界面输入出发地和目的地里程信息车次信息站

3、点信息时间信息历时信息(2).程序说明:打开程序则可直接输入,出发站和目的地点击查询即可获取相关信息,信息的显示需要一段时间,这跟数据的连接的延迟、软件的使用环境有关。点击相关的到达时间、里程、历时等按钮则可按照大小依次排序车次信息。允许程序最大化。 (3).程序主要代码和截图:程序的运行截图:窗体程序设计的代码:namespace WindowsFormsApplication1 partial class 列车时刻表 / <summary> / 必需的设计器变量。 / </summary> private System.ComponentModel.IContain

4、er components = null; / <summary> / 清理所有正在使用的资源。 / </summary> / <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) if (disposing && (components != null) components.Dispose(); base.Dispose(disposing); #

5、region Windows 窗体设计器生成的代码 / <summary> / 设计器支持所需的方法 - 不要 / 使用代码编辑器修改此方法的内容。 / </summary> private void InitializeComponent() ponents = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof

6、(列车时刻表); this.button1 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.dataGridView2 = new System.Windows.F

7、orms.DataGridView(); this.dataSetBindingSource = new System.Windows.Forms.BindingSource(ponents); this.btnDesigner = new System.Windows.Forms.Button(); (System.ComponentModel.ISupportInitialize)(this.dataGridView2).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.dataSetBindingSource).Be

8、ginInit(); this.SuspendLayout(); / / button1 / this.button1.Location = new System.Drawing.Point(642, 20); this.button1.Name = "button1" this.button1.Size = new System.Drawing.Size(63, 28); this.button1.TabIndex = 0; this.button1.Text = "查询" this.button1.UseVisualStyleBackColor =

9、true; this.button1.Click += new System.EventHandler(this.button1_Click); / / label1 / this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(32, 22); this.label1.Name = "label1" this.label1.Size = new System.Drawing.Size(53, 12); this.label1.TabIndex = 1; this.label1.

10、Text = "起始站:" / / label2 / this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(334, 26); this.label2.Name = "label2" this.label2.Size = new System.Drawing.Size(53, 12); this.label2.TabIndex = 2; this.label2.Text = "终点站:" / / textBox1 / this.text

11、Box1.Location = new System.Drawing.Point(102, 17); this.textBox1.Name = "textBox1" this.textBox1.Size = new System.Drawing.Size(183, 21); this.textBox1.TabIndex = 3; / / textBox2 / this.textBox2.Location = new System.Drawing.Point(402, 22); this.textBox2.Name = "textBox2" this.te

12、xtBox2.Size = new System.Drawing.Size(180, 21); this.textBox2.TabIndex = 4; / / dataGridView2 / this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Location = new System.Drawing.Point(24, 54); this.dataGridView2.N

13、ame = "dataGridView2" this.dataGridView2.RowTemplate.Height = 23; this.dataGridView2.Size = new System.Drawing.Size(1059, 410); this.dataGridView2.TabIndex = 5; / / dataSetBindingSource / this.dataSetBindingSource.DataSource = typeof(System.Data.DataSet); this.dataSetBindingSource.Position

14、 = 0; / / btnDesigner / this.btnDesigner.Location = new System.Drawing.Point(834, 22); this.btnDesigner.Name = "btnDesigner" this.btnDesigner.Size = new System.Drawing.Size(113, 23); this.btnDesigner.TabIndex = 6; this.btnDesigner.Text = "关于作者" this.btnDesigner.UseVisualStyleBack

15、Color = true; this.btnDesigner.Click += new System.EventHandler(this.btnDesigner_Click); / / 列车时刻表 / this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1110, 483); this.Controls.Add(thi

16、s.btnDesigner); this.Controls.Add(this.dataGridView2); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.button1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Ic

17、on = (System.Drawing.Icon)(resources.GetObject("$this.Icon"); this.Name = "列车时刻表" this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "列车时刻查询表" this.Load += new System.EventHandler(this.Form1_Load); (System.ComponentModel.ISupportInitia

18、lize)(this.dataGridView2).EndInit(); (System.ComponentModel.ISupportInitialize)(this.dataSetBindingSource).EndInit(); this.ResumeLayout(false); this.PerformLayout(); #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label

19、label2; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.DataGridView dataGridView2; private System.Windows.Forms.BindingSource dataSetBindingSource; private System.Windows.Forms.Button btnDesigner; 软件窗体截图:列车时刻表事件函数代码:namespac

20、e WindowsFormsApplication1 public partial class 列车时刻表 : Form public 列车时刻表() InitializeComponent(); private void button1_Click(object sender, EventArgs e) if (dataGridView2.Visible = false) dataGridView2.Visible = true; string returnValue = new string "车次", "始发站", "终点站",

21、 "发车站", "发车时间", "到达站", "到达时间", "里程", "历时" ;/中文列名 string startStation = textBox1.Text; string arriveStation = textBox2.Text; MyTrainTimeService.TrainTimeWebServiceSoapClient client = new MyTrainTimeService.TrainTimeWebServiceSoapClient(); Da

22、taSet set = client.getStationAndTimeByStationName(startStation, arriveStation, ""); DataTable t = set.Tables0; / 更改列名 for (int i = 0; i < 9; i+) t.Columnsi.ColumnName = returnValuei; / 增加序号列,并把它调到第一列 t.Columns.Add("num"); t.Columns"num".SetOrdinal(0); for (int i = 0; i < t.Rows.Count; i+) t.Rowsi"num" = i + 1; /

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论