2022年人机交互用户界面设计实验报告.docx
精品学习资源试验一图形用户界面的设计一 试验目的和要求1) 熟识图形用户界面的设计原就2) 利用一种设计工具完成图形化的用户界面设计二 试验内容与步骤一 试验内容:利用常用的设计工具 VC/VB/Delphi/PB等 完成一个通用图形用户界面设计,要遵循界面设计的一般原就 一样性、快捷方式、供应错误处理 ,留意颜色的使用,学会使用图标、按钮、屏幕布局、菜单和对话框的设计二试验步骤 1设计多个对话框,完成填表输入界面的设计,合理使用图标、按钮、颜色;2. 设计不同形式的菜单,完成对不同对话框的调用;3. 供应简洁的错误处理、联机帮忙三 界面例如1、登录界面2、主界面欢迎下载精品学习资源3代码: 登录界面:using System;using System.Drawing; using System.Collections;using System ponentModel; using System.Windows.Forms; using System.Data;欢迎下载精品学习资源using System.Data.OleDb;/ <summary>/ Form1 的摘要说明;/ </summary>private 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.Windows.FormsboBox comboName;/ <summary>/ 必需的设计器变量;/ </summary>private SystemponentModel.Container components = null; private System.Windows.Forms.Button btSure;private OleDbConnection oleConnection1 = null;public Login/ Windows 窗体设计器支持所必需的/ InitializeComponent;/ TODO: 在 InitializeComponent 调用后添加任何构造函数代码/ <summary>/ 清理全部正在使用的资源;/ </summary>protected override void Dispose bool disposing if disposing if components .= nullcomponents.Dispose;欢迎下载精品学习资源base.Dispose disposing ;#region Windows 窗体设计器生成的代码/ <summary>/ 设计器支持所需的方法 - 不要使用代码编辑器修改/ 此方法的内容;/ </summary>private void InitializeComponentSystemponentModelponentResourceManager resources = new SystemponentModelponentResourceManagertypeofLogin;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.Windows.Forms.Label; this.label1 = new System.Windows.Forms.Label;thisboName = new System.Windows.FormsboBox; this.SuspendLayout;/ btClose/this.btClose.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btClose.ForeColor = System.Drawing.Color.Black; this.btClose.Location = new System.Drawing.Point159, 220; this.btClose.Name = "btClose"this.btClose.Size = new System.Drawing.Size75, 23; this.btClose.TabIndex = 27;this.btClose.Text = "取消"this.btClose.Click += new System.EventHandlerthis.btClose_Click;/ btSure/this.btSure.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btSure.ForeColor = System.Drawing.Color.Black; this.btSure.Location = new System.Drawing.Point46, 220; this.btSure.Name = "btSure"this.btSure.Size = new System.Drawing.Size75, 23; this.btSure.TabIndex = 26;this.btSure.Text = "确定"this.btSure.Click += new System.EventHandlerthis.btSure_Click;欢迎下载精品学习资源/ password/this.password.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;this.password.Location = new System.Drawing.Point130, 136; this.password.Name = "password" this.password.PasswordChar = '*'this.password.Size = new System.Drawing.Size100, 21; this.password.TabIndex = 25;this.password.Text = "admin"/ label3/this.label3.Font = new System.Drawing.Font"宋体", , System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, byte134;this.label3.ForeColor = System.Drawing.Color.Black; this.label3.Location = new System.Drawing.Point66, 136; this.label3.Name = "label3"this.label3.Size = new System.Drawing.Size56, 23; this.label3.TabIndex = 23;this.label3.Text = "密 码"/ label2/this.label2.Font = new System.Drawing.Font"宋体", , System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, byte134;this.label2.ForeColor = System.Drawing.Color.Black; this.label2.Location = new System.Drawing.Point66, 96; this.label2.Name = "label2"this.label2.Size = new System.Drawing.Size56, 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, byte134;this.label1.ForeColor = System.Drawing.Color.Black; this.label1.Location = new System.Drawing.Point42, 48; this.label1.Name = "label1"this.label1.Size = new System.Drawing.Size208, 28; this.label1.TabIndex = 21;this.label1.Text = "理财治理信息系统 "欢迎下载精品学习资源/ comboName/thisboName.Location = new System.Drawing.Point130, 96; thisboName.Name = "comboName"thisboName.Size = new System.Drawing.Size104, 20; thisboName.TabIndex = 28;/ Login/this.AutoScaleBaseSize = new System.Drawing.Size6, 14; this.BackColor = System.Drawing.Color.SeaShell; this.BackgroundImage =System.Drawing.Imageresources.GetObject"$this.BackgroundImage" this.ClientSize = new System.Drawing.Size298, 287; this.Controls.AddthisboName; this.Controls.Addthis.btClose; this.Controls.Addthis.btSure; this.Controls.Addthis.password; this.Controls.Addthis.label3;this.Controls.Addthis.label2;this.Controls.Addthis.label1; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Login" this.StartPosition =System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "登录"this.Load += new System.EventHandlerthis.Login_Load; this.ResumeLayoutfalse;this.PerformLayout;#endregion/ <summary>/ 应用程序的主入口点;/ </summary> STAThread static void MainApplication.Runnew MainForm;欢迎下载精品学习资源private void btSure_Clickobject sender, System.EventArgs etrystring sql="select uName,PWD from family where uName='"+thisboName.Text +"'"ifoleConnection1=nulloleConnection1 = MainForm.getConnection; OleDbCommand cmd = oleConnection1.CreateCommand; cmdmandText =sql;OleDbDataReader dr = cmd.ExecuteReader; if.dr.Read欢迎下载精品学习资源elseMessageBox.Show"无此用户,请重试! "," 提示" dr.Close;cmd.Dispose; return;if.dr.GetString1.Equals this.password.Text.ToString欢迎下载精品学习资源MessageBox.Show"n密码错误,请重试! "," 提示" dr.Close;cmd.Dispose; return;Menu mainmenu=MainFormthis.MdiParent.getMainMenu;for int i=0;i<6;i+mainmenu.MenuItemsi.Visible=true;欢迎下载精品学习资源StatusBar statusBar = MainFormthis.MdiParent.getStatusBar;statusBar.Panels0.Text=当"前登录用户 "欢迎下载精品学习资源statusBar.Panels1.Text=thisboName.Text.Trim; statusBar.Panels2.Text=DateTime.Now.ToString;statusBar.Panels3.Text=理" 财治理信息系统 "dr.Close; cmd.Dispose; this.Close;欢迎下载精品学习资源catchException eeMessageBox.Show"n"+ee.ToString;private void btClose_Clickobject sender, System.EventArgs ethis.Close;private void Login_Loadobject sender, System.EventArgs eif oleConnection1=null oleConnection1=MainForm.getConnection;/取出系统的全部用户名/显示在下拉列表 ,这样用户登录的时候/挑选用户名就可以了 ,不用再输入用户名了string sql="select uName from family"OleDbCommand cmd = new OleDbCommandsql,oleConnection1; OleDbDataReader dr = cmd.ExecuteReader;int flag = 0; whiledr.ReadthisboName.Items.Adddr.GetString0; flag+;/假如系统存在用户 ,就默认选中第一个用户if flag>0thisboName.SelectedIndex=0; dr.Close;cmd.Dispose;主界面:using System;using System.Drawing; using System.Collections;using System ponentModel; using System.Windows.Forms; using System.Data;欢迎下载精品学习资源using System.Data.OleDb;/ <summary>/ Form1 的摘要说明;/ </summary>private 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.Windows.FormsboBox comboName;/ <summary>/ 必需的设计器变量;/ </summary>private SystemponentModel.Container components = null; private System.Windows.Forms.Button btSure;private OleDbConnection oleConnection1 = null;public Login/ Windows 窗体设计器支持所必需的/ InitializeComponent;/ TODO: 在 InitializeComponent 调用后添加任何构造函数代码/ <summary>/ 清理全部正在使用的资源;/ </summary>protected override void Dispose bool disposing if disposing if components .= nullcomponents.Dispose;欢迎下载精品学习资源base.Dispose disposing ;#region Windows 窗体设计器生成的代码/ <summary>/ 设计器支持所需的方法 - 不要使用代码编辑器修改/ 此方法的内容;/ </summary>private void InitializeComponentSystemponentModelponentResourceManager resources = new SystemponentModelponentResourceManagertypeofLogin;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.Windows.Forms.Label; this.label1 = new System.Windows.Forms.Label;thisboName = new System.Windows.FormsboBox; this.SuspendLayout;/ btClose/this.btClose.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btClose.ForeColor = System.Drawing.Color.Black; this.btClose.Location = new System.Drawing.Point159, 220; this.btClose.Name = "btClose"this.btClose.Size = new System.Drawing.Size75, 23; this.btClose.TabIndex = 27;this.btClose.Text = "取消"this.btClose.Click += new System.EventHandlerthis.btClose_Click;/ btSure/this.btSure.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btSure.ForeColor = System.Drawing.Color.Black; this.btSure.Location = new System.Drawing.Point46, 220; this.btSure.Name = "btSure"this.btSure.Size = new System.Drawing.Size75, 23; this.btSure.TabIndex = 26;this.btSure.Text = "确定"this.btSure.Click += new System.EventHandlerthis.btSure_Click;欢迎下载精品学习资源/ password/this.password.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;this.password.Location = new System.Drawing.Point130, 136; this.password.Name = "password" this.password.PasswordChar = '*'this.password.Size = new System.Drawing.Size100, 21; this.password.TabIndex = 25;this.password.Text = "admin"/ label3/this.label3.Font = new System.Drawing.Font"宋体", , System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, byte134;this.label3.ForeColor = System.Drawing.Color.Black; this.label3.Location = new System.Drawing.Point66, 136; this.label3.Name = "label3"this.label3.Size = new System.Drawing.Size56, 23; this.label3.TabIndex = 23;this.label3.Text = "密 码"/ label2/this.label2.Font = new System.Drawing.Font"宋体", , System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, byte134;this.label2.ForeColor = System.Drawing.Color.Black; this.label2.Location = new System.Drawing.Point66, 96; this.label2.Name = "label2"this.label2.Size = new System.Drawing.Size56, 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, byte134;this.label1.ForeColor = System.Drawing.Color.Black; this.label1.Location = new System.Drawing.Point42, 48; this.label1.Name = "label1"this.label1.Size = new System.Drawing.Size208, 28; this.label1.TabIndex = 21;this.label1.Text = "理财治理信息系统 "欢迎下载精品学习资源/ comboName/thisboName.Location = new System.Drawing.Point130, 96; thisboName.Name = "comboName"thisboName.Size = new System.Drawing.Size104, 20; thisboName.TabIndex = 28;/ Login/this.AutoScaleBaseSize = new System.Drawing.Size6, 14; this.BackColor = System.Drawing.Color.SeaShell; this.BackgroundImage =System.Drawing.Imageresources.GetObject"$this.BackgroundImage" this.ClientSize = new System.Drawing.Size298, 287; this.Controls.AddthisboName; this.Controls.Addthis.btClose; this.Controls.Addthis.btSure; this.Controls.Addthis.password; this.Controls.Addthis.label3;this.Controls.Addthis.label2;this.Controls.Addthis.label1; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Login" this.StartPosition =System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "登录"this.Load += new System.EventHandlerthis.Login_Load; this.ResumeLayoutfalse;this.PerformLayout;#endregion/ <summary>/ 应用程序的主入口点;/ </summary> STAThread static void MainApplication.Runnew MainForm;欢迎下载精品学习资源private void btSure_Clickobject sender, System.EventArgs etrystring sql="select uName,PWD from family where uName='"+thisboName.Text +"'"ifoleConnection1=nulloleConnection1 = MainForm.getConnection; OleDbCommand cmd = oleConnection1.CreateCommand; cmdmandText =sql;OleDbDataReader dr = cmd.ExecuteReader; if.dr.Read欢迎下载精品学习资源elseMessageBox.Show"无此用户,请重试! "," 提示" dr.Close;cmd.Dispose; return;if.dr.GetString1.Equals this.password.Text.ToString欢迎下载精品学习资源MessageBox.Show"n密码错误,请重试! "," 提示" dr.Close;cmd.Dispose; return;Menu mainmenu=MainFormthis.MdiParent.getMainMenu;for int i=0;i<6;i+mainmenu.MenuItemsi.Visible=true;欢迎下载精品学习资源StatusBar statusBar = MainFormthis.MdiParent.getStatusBar;statusBar.Panels0.Text=当"前登录用户 "欢迎下载精品学习资源statusBar.Panels1.Text=thisboName.Text.Trim; statusBar.Panels2.Text=DateTime.Now.ToString;statusBar.Panels3.Text=理" 财治理信息系统 "dr.Close; cmd.Dispose; this.Close;欢迎下载精品学习资源catchException eeMessageBox.Show"n"+ee.ToString;private void btClose_Clickobject sender, System.EventArgs ethis.Close;private void Login_Loadobject sender, System.EventArgs eif oleConnection1=null oleConnection1=MainForm.getConnection;/取出系统的全部用户名/显示在下拉列表 ,这样用户登录的时候/挑选用户名就可以了 ,不用再输入用户名了string sql="select uName from family"OleDbCommand cmd = new OleDbCommandsql,oleConnection1; OleDbDataReader dr = cmd.ExecuteReader;int flag = 0; whiledr.ReadthisboName.Items.Adddr.GetString0; flag+;/假如系统存在用户 ,就默认选中第一个用户if flag>0thisboName.SelectedIndex=0; dr.Close;cmd.Dispose;四 试验总结1. 界面要具有一样性、常用操作要有快捷方式、供应简洁的错误处理、对操 作人员的重要操作要有信息反馈、 操作可逆、 设计良好的联机帮忙、 合理划分并欢迎下载精品学习资源高效地使用显示屏、保证信息显示方式与数据输入方式的和谐一样2. 颜色是一种有效的强化手段,同时具有美学价值;使用颜色时应留意如下几点:限制同时显示的颜色数; 画面中活动对象的颜色应鲜明, 而非活动对象应暗淡;尽量防止不相容的颜色放在一起,如黄与蓝,红与绿等,除非作比照时用; 假设用颜色表示某种信息或对象属性,要使用户懂得这种表示,并尽量采纳通用的表示规章;3. 图标是可视地表示实体信息的简洁、抽象的符号;图标设计是方寸艺术,需要在很小的范畴内表现出图标的内涵;设计图标时应当着重考虑视觉冲击力,要使用简洁的颜色,利用眼睛对颜色和网点的空间混合成效,做出出色图标;1) 设计按钮应当具有交互性,应当有 3 到 6 种状态成效 点击时的状态、鼠标放在上面但未点击的状态、 点击前鼠标未放在上面时的状态、 点击后鼠标未放在上面时的状态、不能点击时的状态、独立自动变化的状态,按钮应具备简洁的图示成效, 应能够让使用者产生功能上的关联反应; 属于一个群组的按钮应当风格统