atmform.cs

来自「是一个模拟ATM的程序」· CS 代码 · 共 543 行 · 第 1/2 页

CS
543
字号
			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblType);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,1);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.types);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,2);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblID);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,2);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.ID);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,3);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblName);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,3);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.name);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,4);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblPassword);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,4);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.password);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,5);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblRepwd);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,5);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.repwd);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,6);			tlcc.size=new Size(3,1);			tly.addCellConstraint(tlcc);			page.Add(this.submit);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(6,6);			tly.addCellConstraint(tlcc);			page.Add(this.cancel);			pages.Add(ATMForm.REGISTER_PAGE,page);			layouts.Add(ATMForm.REGISTER_PAGE,tly);						//Login Page			page=new ArrayList();			tly=new TableLayout(this,10,6);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,1);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblType);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,1);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.types);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,2);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblCardNo);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,2);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.cardNo);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,3);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblOldPWD);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,3);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.password);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,4);			tlcc.size=new Size(3,1);			tly.addCellConstraint(tlcc);			page.Add(this.authenticat);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(6,4);			tly.addCellConstraint(tlcc);			page.Add(this.cancel);			pages.Add(ATMForm.LOGIN_PAGE,page);			layouts.Add(ATMForm.LOGIN_PAGE,tly);						//Deposit page			page=new ArrayList();			tly=new TableLayout(this,10,6);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(2,2);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblAmount);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(4,2);			tlcc.size=new Size(5,1);			tly.addCellConstraint(tlcc);			page.Add(this.amount);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,4);			tlcc.size=new Size(3,1);			tly.addCellConstraint(tlcc);			page.Add(this.confirm);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(6,4);			tly.addCellConstraint(tlcc);			page.Add(this.cancel);			pages.Add(ATMForm.DEPOSIT_PAGE,page);			layouts.Add(ATMForm.DEPOSIT_PAGE,tly);						//Draw Page			page=new ArrayList();			tly=new TableLayout(this,10,6);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(2,1);			tlcc.size=new Size(7,1);			tly.addCellConstraint(tlcc);			page.Add(this.balance);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(2,2);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblAmount);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(4,2);			tlcc.size=new Size(5,1);			tly.addCellConstraint(tlcc);			page.Add(this.amount);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,3);			tlcc.size=new Size(3,1);			tly.addCellConstraint(tlcc);			page.Add(this.confirm);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(6,3);			tly.addCellConstraint(tlcc);			page.Add(this.cancel);			pages.Add(ATMForm.DRAW_PAGE,page);			layouts.Add(ATMForm.DRAW_PAGE,tly);						//Query Page			page=new ArrayList();			tly=new TableLayout(this,10,6);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(2,1);			tlcc.size=new Size(7,1);			tly.addCellConstraint(tlcc);			page.Add(this.balance);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(6,3);			tlcc.size=new Size(3,1);			tly.addCellConstraint(tlcc);			page.Add(this.cancel);			pages.Add(ATMForm.QUERY_PAGE,page);			layouts.Add(ATMForm.QUERY_PAGE,tly);						//Modify Password			page=new ArrayList();			tly=new TableLayout(this,10,6);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,1);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblOldPWD);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,1);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.oldPWD);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,2);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblPassword);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,2);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.password);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(1,3);			tlcc.size=new Size(2,1);			tly.addCellConstraint(tlcc);			page.Add(this.lblRepwd);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,3);			tlcc.size=new Size(6,1);			tly.addCellConstraint(tlcc);			page.Add(this.repwd);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(3,4);			tlcc.size=new Size(3,1);			tly.addCellConstraint(tlcc);			page.Add(this.submit);			tlcc=(TableLayout.CellConstraint)tlcc.Clone();			tlcc.location=new Point(6,4);			tly.addCellConstraint(tlcc);			page.Add(this.cancel);			pages.Add(ATMForm.MODIFY_PASSWORD_PAGE,page);			layouts.Add(ATMForm.MODIFY_PASSWORD_PAGE,tly);		}				private Button createButton(String info,String delegater){			try{				string className=(delegater.StartsWith("ATM."))?delegater:"ATM."+delegater;				Assembly a=Assembly.Load("ATM");				Type type=a.GetType(className);				IButtonDelegater handler=(IButtonDelegater)Activator.CreateInstance(type);								Button btn=new Button();				btn.Name=info.Replace(" ","");				btn.Text=info.Replace("_"," ");				btn.Click+=new System.EventHandler(handler.Execute);								return btn;			}catch(ArgumentNullException ane){				Console.Error.WriteLine(ane.Message);				return null;			}		}				private Label createLabel(String info){			Label lbl=new Label();			lbl.Text=info;			lbl.Name="lbl"+info.Replace(" ","");			lbl.AutoSize=false;			return lbl;		}				private TextBox createTextBox(String info,int ml,bool isPassword){			TextBox tb=new TextBox();			tb.Name=info.Replace(" ","");			tb.MaxLength=ml;			tb.AutoSize=false;			if (isPassword)				tb.PasswordChar='*';			return tb;		}				private ComboBox createComboBox(String info,Object [] datas){			ComboBox cb=new ComboBox();			cb.Name=info.Replace(" ","");			cb.DropDownStyle=ComboBoxStyle.DropDownList;			foreach(Object bank in datas)				cb.Items.Add(bank);			cb.SelectedItem=cb.Items[0];			return cb;		}	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?