C#三层ATM-4.ATM界面设计

ATM界面设计

1.打开WinF项目,新建窗体Main-最终-效果如下。

未登录状态:

wpsCC0A.tmp

登陆后:

wpsCC1B.tmp

(1)修改窗体的相关属性

属性:

1)text:标题文字  

2)icon:图标

3)StartPosition(起始位置):centerScreen

4)windowstate(起始状态):maximized

(2)加入菜单控件--menuStrip1

1)编辑菜单项

wpsCC2B.tmp

2)设置账户管理子菜单

wpsCC3C.tmp

3)设置现金操作子菜单

wpsCC4C.tmp

4)设置状态

把账户管理、现金操作、查交易明细、退出账户四个菜单项的enabled设置为false

(3)加入状态栏控件--statusStrip1

1)增加一个状态栏文本标签toolStripStatusLabel1

2)通过Text属性设置toolStripStatusLabel1的文字

2.打开Program.cs,修改项目的启动窗口。

wpsCC4D.tmp

设计窗口--属性设置

以下窗口均要设置以下属性:

(1)startPosition(起始位置):centerParent

(2)showIcon(显示图标):false

(3)MaximizeBox(显示最大化按钮):false

(4)minimizeBox(显示最小化按钮):false

(5)Text(窗口标题)

3.设计登录界面-Login

wpsCC5E.tmp

显示结果的label的ForeColor设置为红色,text设置为空。下同。

账号输入框设置maxLength为16

密码输入框设置maxLength为6,passwordChar设置为*

4.设计查余额界面--Show

wpsCC5F.tmp

5.设计改密码界面--changePWD

wpsCC70.tmp

密码输入框设置maxLength为6,passwordChar设置为*

6.设计挂失界面--lost

wpsCC71.tmp

7.设计取款界面-GetMoney

wpsCC72.tmp

本处用到数字控件控件: numericUpDown 属性value设置为1,maximum设置为5000。第8、9步操作也用到此控件,相同操作。

8.设计存款界面-SetMoney

wpsCC82.tmp

9.设计转账界面-Transfer

wpsCC83.tmp

对方账号输入框设置maxLength为16

10.设计查交易明细界面-getTrans

wpsCC84.tmp

添加控件dataGridView进行以下设置:

(1)设置readOnly为true

(2)dock设置为fill

(3)点击columns属性编辑绑定列,如下图。

wpsCC95.tmp

(4)增加列地方如下。

wpsCCA5.tmp

(5)各列的属性设置

 

HeadText

DataPropertyName

日期

日期

transDate

交易类型

交易类型

transType

交易金额

交易金额

transMoney

备注

备注

remark

11.设计新开户界面-NewCard

wpsCCA6.tmp

(1)身份证号外面添加groupbox,设置text属性。

(2)身份证号输入框设置maxLength为18。

(3)地址输入框设置multiline为true,调整高度。

(4)存款类型为comboBox控件,点击属性里的items,编辑内容。

wpsCCB7.tmp

(5)开户金额为numericUpDown 属性value设置为1,maximum设置为5000。

(6)密码输入框设置maxLength为6,passwordChar设置为*

转载于:https://www.cnblogs.com/lingr/p/5563551.html

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
老师认为较成功的程序 // ATM.cs // ATM项目中的ATM类源文件 using System; using System.Collections.Generic; using System.Text; namespace ATM { class ATM { private const string quitCode = "20060824"; private Bank bank; public ATM(Bank bank) { this.bank = bank; } public void Start() { while (true) { // 主界面 PrintLogo(); Console.WriteLine(" 1. 开户 "); Console.WriteLine(" 2. 登录 "); Console.WriteLine("----------------------------------------------"); Console.WriteLine(""); Console.Write("你的选择(回车结束):"); string code = Console.ReadLine(); // quit system if (code == quitCode) return; if (code == "1") // 开户 OpenAccount(); else if (code == "2") // 登陆 LoginAccount(); } } private void LoginAccount() { PrintLogo(); Console.WriteLine(" 请输入你的帐号的用户名和密码 "); Console.WriteLine("----------------------------------------------"); Console.WriteLine(""); string name = Input("用户名(回车结束):"); string password = Input("密码(回车结束):"); // 登录帐号 Account account; if (!bank.LoginAccount(name, password, out account)) { Console.Write("登录错误,请检查用户名和密码是否正确。按Enter键继续..."); Console.Read(); } else { ManageAccount(ref account); } } private void OpenAccount() { PrintLogo(); Console.WriteLine(" 请输入你的帐号的用户名和密码 "); Console.WriteLine("----------------------------------------------"); Console.WriteLine(""); string name = Input("用户名(回车结束):"); string password = Input("密码(回车结束):"); // 开户 Account account; if (!bank.OpenAccount(name, password, out account)) { Console.Write("开户错误,用户名可能已经存在。按Enter键继续..."); Console.Read(); } else { Print("开户", 0, account); Pause(); ManageAccount(ref account); } } private void ManageAccount(ref Account account) { while (true) { // 管理帐号界面 PrintLogo(); Console.WriteLine(" 1. 存款 "); Console.WriteLine(" 2. 取款 "); Console.WriteLine(" 3. 查询余额 "); Console.WriteLine(" 4. 修改密码 "); Console.WriteLine(" 5. 退出 "); Console.WriteLine("----------------------------------------------"); Console.WriteLine(""); Console.Write("你的选择(回车结束):"); string code = Console.ReadLine(); decimal amount; bool succeed; switch (code) { case "1": amount = InputNumber("\n输入存款数目:"); succeed = account.Deposit(amount); if (succeed) { Print("存入", amount, account); } else { Console.WriteLine("存款失败!"); } Pause(); break; case "2": amount = InputNumber("\n输入取款数目:"); succeed = account.Withdraw(amount); if (succeed) { Print("取出", amount, account); } else { Console.WriteLine("取款失败!"); } Pause(); break; case "3": Print(account); Pause(); break; case "4": string oldPassword = Input("当前密码(回车结束):"); string newPassword = Input("新密码(回车结束):"); succeed = account.ChangePassword(oldPassword, newPassword); if (succeed) Console.WriteLine("密码修改成功!"); else Console.WriteLine("密码修改失败!"); Pause(); break; case "5": return; default: break; } } } private void PrintLogo() { Console.WriteLine("\n----------------------------------------------"); Console.WriteLine(" {0}自动取款 用户第一 服务之上 ", bank.Name); Console.WriteLine("----------------------------------------------"); } private string Input(string prompt) { Console.Write(prompt); string str = Console.ReadLine(); while (str == "") { Console.Write("不能为空,{0}", prompt); str = Console.ReadLine(); } return str; } private decimal InputNumber(string prompt) { Console.Write(prompt); string s = Console.ReadLine(); decimal amount = 0; try { amount = Decimal.Parse(s); } catch (Exception) // 捕获任何异常 { Console.Write("输入的数值格式不正确,请重新输入!"); // 提示错误 amount = InputNumber(prompt); // 递归调用InputNumber } return amount; } private void Pause() { Console.Write("按Enter键继续..."); Console.Read(); } private void Print(string operation, decimal amount, Account account) { Console.WriteLine("---------------------------"); Console.WriteLine("姓名: {0}", account.Name); Console.WriteLine("{0}: {1}", operation, amount); Console.WriteLine("余额: {0}", account.Balance); Console.WriteLine("---------------------------"); Console.WriteLine("{0}成功!", operation); } public void Print(Account account) { Console.WriteLine("---------------------------"); Console.WriteLine("姓名: {0}", account.Name); Console.WriteLine("余额: {0}", account.Balance); Console.WriteLine("---------------------------"); } } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值