版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实验一 图形用户界面的设计一 实验目的和要求1) 熟悉图形用户界面的设计原则2)利用一种设计工具完成图形化的用户界面设计二 实验内容与步骤(一) 实验内容:利用常用的设计工具(VC/VB/Delphi/PB等)完成一个通用图形用户界面设计,要遵循界面设计的一般原则(一致性、快捷方式、提供错误处理),注意颜色的使用,学会使用图标、按钮、屏幕布局、菜单和对话框的设计(二)实验步骤1设计多个对话框,完成填表输入界面的设计,合理使用图标、按钮、颜色;2设计不同形式的菜单,完成对不同对话框的调用;3提供简单的错误处理、联机帮助三 界面示例1、 登录界面2、主界面3代码:登录界面:using System
2、;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Data.OleDb;/ Download by namespace WealthMIS.user/ / Form1 的摘要说明。/ public class Login : System.Windows.Forms.Formprivate System.Windows.Forms.But
3、ton btClose;private System.Windows.Forms.TextBox password;private System.Windows.Forms.Label label3;private System.Windows.Forms.Label label2;private System.Windows.Forms.Label label1;private System.Windows.Forms.ComboBox comboName;/ / 必需的设计器变量。/ private System.ComponentModel.Container components =
4、null;private System.Windows.Forms.Button btSure;private OleDbConnection oleConnection1 = null;public Login()/ Windows 窗体设计器支持所必需的/InitializeComponent();/ TODO: 在 InitializeComponent 调用后添加任何构造函数代码/ / 清理所有正在使用的资源。/ protected override void Dispose( bool disposing )if( disposing )if (components != null)
5、 components.Dispose();base.Dispose( disposing );#region Windows 窗体设计器生成的代码/ / 设计器支持所需的方法 - 不要使用代码编辑器修改/ 此方法的内容。/ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Login); this.btClose = new System.W
6、indows.Forms.Button(); this.btSure = new System.Windows.Forms.Button(); this.password = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); boName = new System.Wind
7、ows.Forms.ComboBox(); this.SuspendLayout(); / / btClose / this.btClose.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btClose.ForeColor = System.Drawing.Color.Black; this.btClose.Location = new System.Drawing.Point(159, 220); this.btClose.Name = btClose; this.btClose.Size = new System.Drawin
8、g.Size(75, 23); this.btClose.TabIndex = 27; this.btClose.Text = 取消; this.btClose.Click += new System.EventHandler(this.btClose_Click); / / btSure / this.btSure.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btSure.ForeColor = System.Drawing.Color.Black; this.btSure.Location = new System.Draw
9、ing.Point(46, 220); this.btSure.Name = btSure; this.btSure.Size = new System.Drawing.Size(75, 23); this.btSure.TabIndex = 26; this.btSure.Text = 确定; this.btSure.Click += new System.EventHandler(this.btSure_Click); / / password / this.password.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingl
10、e; this.password.Location = new System.Drawing.Point(130, 136); this.password.Name = password; this.password.PasswordChar = *; this.password.Size = new System.Drawing.Size(100, 21); this.password.TabIndex = 25; this.password.Text = admin; / / label3 / this.label3.Font = new System.Drawing.Font(宋体, 1
11、0.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label3.ForeColor = System.Drawing.Color.Black; this.label3.Location = new System.Drawing.Point(66, 136); this.label3.Name = label3; this.label3.Size = new System.Drawing.Size(56, 23); this.label3.TabIndex = 23;
12、 this.label3.Text = 密 码; / / label2 / this.label2.Font = new System.Drawing.Font(宋体, 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label2.ForeColor = System.Drawing.Color.Black; this.label2.Location = new System.Drawing.Point(66, 96); this.label2.Name = l
13、abel2; this.label2.Size = new System.Drawing.Size(56, 23); this.label2.TabIndex = 22; this.label2.Text = 用户名; / / label1 / this.label1.Font = new System.Drawing.Font(楷体_GB2312, 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label1.ForeColor = System.Drawing.
14、Color.Black; this.label1.Location = new System.Drawing.Point(42, 48); this.label1.Name = label1; this.label1.Size = new System.Drawing.Size(208, 28); this.label1.TabIndex = 21; this.label1.Text = 理财管理信息系统; / / comboName / boName.Location = new System.Drawing.Point(130, 96); boName.Na
15、me = comboName; boName.Size = new System.Drawing.Size(104, 20); boName.TabIndex = 28; / / Login / this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.Color.SeaShell; this.BackgroundImage = (System.Drawing.Image)(resources.GetObject($this.Backgroun
16、dImage); this.ClientSize = new System.Drawing.Size(298, 287); this.Controls.Add(boName); this.Controls.Add(this.btClose); this.Controls.Add(this.btSure); this.Controls.Add(this.password); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Max
17、imizeBox = false; this.MinimizeBox = false; this.Name = Login; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = 登录; this.Load += new System.EventHandler(this.Login_Load); this.ResumeLayout(false); this.PerformLayout();#endregion/ / 应用程序的主入口点。/ STAThreadstatic voi
18、d Main() Application.Run(new MainForm();private void btSure_Click(object sender, System.EventArgs e)trystring sql=select uName,PWD from family where uName=+boName.Text +;if(oleConnection1=null) oleConnection1 = MainForm.getConnection();OleDbCommand cmd = oleConnection1.CreateCommand();cmd.Co
19、mmandText =sql; OleDbDataReader dr = cmd.ExecuteReader();if(!dr.Read()MessageBox.Show(无此用户,请重试!,提示);dr.Close();cmd.Dispose();return;elseif(!dr.GetString(1).Equals (this.password.Text.ToString()MessageBox.Show(n密码错误,请重试!,提示);dr.Close();cmd.Dispose();return;Menu mainmenu=(MainForm)(this.MdiParent).get
20、MainMenu();for (int i=0;i0)boName.SelectedIndex=0;dr.Close();cmd.Dispose(); 主界面:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Data.OleDb;/ Download by namespace WealthMIS.
21、user/ / Form1 的摘要说明。/ public class Login : System.Windows.Forms.Formprivate System.Windows.Forms.Button btClose;private System.Windows.Forms.TextBox password;private System.Windows.Forms.Label label3;private System.Windows.Forms.Label label2;private System.Windows.Forms.Label label1;private System.W
22、indows.Forms.ComboBox comboName;/ / 必需的设计器变量。/ private System.ComponentModel.Container components = null;private System.Windows.Forms.Button btSure;private OleDbConnection oleConnection1 = null;public Login()/ Windows 窗体设计器支持所必需的/InitializeComponent();/ TODO: 在 InitializeComponent 调用后添加任何构造函数代码/ / 清
23、理所有正在使用的资源。/ protected override void Dispose( bool disposing )if( disposing )if (components != null) components.Dispose();base.Dispose( disposing );#region Windows 窗体设计器生成的代码/ / 设计器支持所需的方法 - 不要使用代码编辑器修改/ 此方法的内容。/ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resou
24、rces = new System.ComponentModel.ComponentResourceManager(typeof(Login); this.btClose = new System.Windows.Forms.Button(); this.btSure = new System.Windows.Forms.Button(); this.password = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Win
25、dows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); boName = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); / / btClose / this.btClose.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btClose.ForeColor = System.Drawing.Color.Black; this.btClose.Location = ne
26、w System.Drawing.Point(159, 220); this.btClose.Name = btClose; this.btClose.Size = new System.Drawing.Size(75, 23); this.btClose.TabIndex = 27; this.btClose.Text = 取消; this.btClose.Click += new System.EventHandler(this.btClose_Click); / / btSure / this.btSure.FlatStyle = System.Windows.Forms.FlatSty
27、le.Popup; this.btSure.ForeColor = System.Drawing.Color.Black; this.btSure.Location = new System.Drawing.Point(46, 220); this.btSure.Name = btSure; this.btSure.Size = new System.Drawing.Size(75, 23); this.btSure.TabIndex = 26; this.btSure.Text = 确定; this.btSure.Click += new System.EventHandler(this.b
28、tSure_Click); / / password / this.password.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.password.Location = new System.Drawing.Point(130, 136); this.password.Name = password; this.password.PasswordChar = *; this.password.Size = new System.Drawing.Size(100, 21); this.password.TabI
29、ndex = 25; this.password.Text = admin; / / label3 / this.label3.Font = new System.Drawing.Font(宋体, 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label3.ForeColor = System.Drawing.Color.Black; this.label3.Location = new System.Drawing.Point(66, 136); this.
30、label3.Name = label3; this.label3.Size = new System.Drawing.Size(56, 23); this.label3.TabIndex = 23; this.label3.Text = 密 码; / / label2 / this.label2.Font = new System.Drawing.Font(宋体, 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label2.ForeColor = Syste
31、m.Drawing.Color.Black; this.label2.Location = new System.Drawing.Point(66, 96); this.label2.Name = label2; this.label2.Size = new System.Drawing.Size(56, 23); this.label2.TabIndex = 22; this.label2.Text = 用户名; / / label1 / this.label1.Font = new System.Drawing.Font(楷体_GB2312, 18F, System.Drawing.Fon
32、tStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label1.ForeColor = System.Drawing.Color.Black; this.label1.Location = new System.Drawing.Point(42, 48); this.label1.Name = label1; this.label1.Size = new System.Drawing.Size(208, 28); this.label1.TabIndex = 21; this.label1.Text = 理财管理
33、信息系统; / / comboName / boName.Location = new System.Drawing.Point(130, 96); boName.Name = comboName; boName.Size = new System.Drawing.Size(104, 20); boName.TabIndex = 28; / / Login / this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawi
34、ng.Color.SeaShell; this.BackgroundImage = (System.Drawing.Image)(resources.GetObject($this.BackgroundImage); this.ClientSize = new System.Drawing.Size(298, 287); this.Controls.Add(boName); this.Controls.Add(this.btClose); this.Controls.Add(this.btSure); this.Controls.Add(this.password); this
35、.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = Login; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = 登录; this.Load += new System.EventHandler(this.Login
36、_Load); this.ResumeLayout(false); this.PerformLayout();#endregion/ / 应用程序的主入口点。/ STAThreadstatic void Main() Application.Run(new MainForm();private void btSure_Click(object sender, System.EventArgs e)trystring sql=select uName,PWD from family where uName=+boName.Text +;if(oleConnection1=null) oleConnection1 = MainForm.getConnection();OleDbCommand cmd = oleConnection1.CreateCommand();cmd.CommandText =sql; OleDbDataReader dr = cmd.ExecuteReader();if(!dr.Read()MessageBox.Show(无此用户,请重试!,提示);dr.Close();cmd.Dispose();return;elseif(!dr.GetString(1).Equals (this.password.Text.ToS
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 天然气提氦操作工安全技能能力考核试卷含答案
- 压电石英片烧银焊线工操作管理强化考核试卷含答案
- 轮轴装修工安全意识强化测试考核试卷含答案
- 油锯工安全文化考核试卷含答案
- 米面主食制作工改进模拟考核试卷含答案
- 砚台雕刻工健康知识强化考核试卷含答案
- 保险公估人发展趋势考核试卷含答案
- 真空测试工安全生产基础知识模拟考核试卷含答案
- 磨矿分级工岗中知识竞赛考核试卷含答案
- 液化天然气储运工岗中复测考核试卷含答案
- 2026年非接触式物位仪表行业技术创新与应用报告
- 2026中国新能源电池材料技术突破与市场前景研究报告
- 2026年综合管理岗试题及答案
- 2027届高考思想政治《指向学科思维培养的高考政治复习备考策略》
- 2026年《中国肺动脉高压诊断治疗指南(2026版)》
- (2026年)康复医学科住院患者医疗安全管理制度与措施
- 手术室净化监理细则
- 2026年发展对象培训班考试题库(含完整答案解析)
- 2026年西学中考试题库及答案
- (2026)院感考试试题(含答案)
- 2026年燃气从业资格证模拟题及完整答案详解1套
评论
0/150
提交评论