计算机程序.doc_第1页
计算机程序.doc_第2页
计算机程序.doc_第3页
计算机程序.doc_第4页
计算机程序.doc_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

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

文档简介

面向对象程序设计期末作品 面向对象程序设计期末作品作品名称:基于C#的简易计算器的程序设计作品功能:(1)采用计算器屏幕按钮完成数的加减乘除等基本计算器功能; (2)采用键盘输入完成数的加减乘除等基本计算器功能; (3)实现上述两个功能的自动切换。作品界面:作品界面要求如下:作品代码如下:计算机窗体程序编写如下:namespace Calculator.cs partial class Form1 / / Required designer variable. / private System.ComponentModel.IContainer components = null; / / Clean up any resources being used. / / true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) if (disposing & (components != null) components.Dispose(); base.Dispose(disposing); #region Windows Form Designer generated code / / Required method for Designer support - do not modify / the contents of this method with the code editor. / private void InitializeComponent() this.textBox1 = new System.Windows.Forms.TextBox(); this.panel1 = new System.Windows.Forms.Panel(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button16 = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); this.button17 = new System.Windows.Forms.Button(); this.button15 = new System.Windows.Forms.Button(); this.button14 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button(); this.button12 = new System.Windows.Forms.Button(); this.button18 = new System.Windows.Forms.Button(); this.button23 = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); this.button19 = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.panel3.SuspendLayout(); this.SuspendLayout(); / / textBox1 / this.textBox1.Location = new System.Drawing.Point(12, 28); this.textBox1.Name = textBox1; this.textBox1.Size = new System.Drawing.Size(327, 21); this.textBox1.TabIndex = 5; this.textBox1.Text = 0.; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); / / panel1 / this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel1.Controls.Add(this.button11); this.panel1.Controls.Add(this.button10); this.panel1.Controls.Add(this.button9); this.panel1.Controls.Add(this.button8); this.panel1.Controls.Add(this.button7); this.panel1.Controls.Add(this.button2); this.panel1.Controls.Add(this.button1); this.panel1.Controls.Add(this.button6); this.panel1.Controls.Add(this.button5); this.panel1.Controls.Add(this.button4); this.panel1.Controls.Add(this.button3); this.panel1.Location = new System.Drawing.Point(0, 88); this.panel1.Name = panel1; this.panel1.Size = new System.Drawing.Size(138, 165); this.panel1.TabIndex = 6; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); / / button11 / this.button11.Location = new System.Drawing.Point(46, 120); this.button11.Name = button11; this.button11.Size = new System.Drawing.Size(73, 30); this.button11.TabIndex = 10; this.button11.Text = 00; this.button11.UseVisualStyleBackColor = true; this.button11.Click += new System.EventHandler(this.button11_Click); / / button10 / this.button10.Location = new System.Drawing.Point(4, 122); this.button10.Name = button10; this.button10.Size = new System.Drawing.Size(36, 30); this.button10.TabIndex = 9; this.button10.Text = 0; this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); / / button9 / this.button9.Location = new System.Drawing.Point(89, 86); this.button9.Name = button9; this.button9.Size = new System.Drawing.Size(36, 30); this.button9.TabIndex = 8; this.button9.Text = 9; this.button9.UseVisualStyleBackColor = true; this.button9.Click += new System.EventHandler(this.button9_Click); / / button8 / this.button8.Location = new System.Drawing.Point(46, 86); this.button8.Name = button8; this.button8.Size = new System.Drawing.Size(39, 30); this.button8.TabIndex = 7; this.button8.Text = 8; this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click); / / button7 / this.button7.Location = new System.Drawing.Point(3, 86); this.button7.Name = button7; this.button7.Size = new System.Drawing.Size(37, 30); this.button7.TabIndex = 6; this.button7.Text = 7; this.button7.UseVisualStyleBackColor = true; this.button7.Click += new System.EventHandler(this.button7_Click); / / button2 / this.button2.Location = new System.Drawing.Point(46, 16); this.button2.Name = button2; this.button2.Size = new System.Drawing.Size(37, 30); this.button2.TabIndex = 1; this.button2.Text = 2; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); / / button1 / this.button1.Location = new System.Drawing.Point(4, 16); this.button1.Name = button1; this.button1.Size = new System.Drawing.Size(36, 30); this.button1.TabIndex = 0; this.button1.Text = 1; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click_1); / / button6 / this.button6.Location = new System.Drawing.Point(89, 50); this.button6.Name = button6; this.button6.Size = new System.Drawing.Size(36, 30); this.button6.TabIndex = 5; this.button6.Text = 6; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button6_Click); / / button5 / this.button5.Location = new System.Drawing.Point(46, 50); this.button5.Name = button5; this.button5.Size = new System.Drawing.Size(38, 30); this.button5.TabIndex = 4; this.button5.Text = 5; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); / / button4 / this.button4.Location = new System.Drawing.Point(3, 50); this.button4.Name = button4; this.button4.Size = new System.Drawing.Size(37, 30); this.button4.TabIndex = 3; this.button4.Text = 4; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); / / button3 / this.button3.Location = new System.Drawing.Point(89, 16); this.button3.Name = button3; this.button3.Size = new System.Drawing.Size(36, 30); this.button3.TabIndex = 2; this.button3.Text = 3; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); / / button16 / this.button16.Location = new System.Drawing.Point(5, 121); this.button16.Name = button16; this.button16.Size = new System.Drawing.Size(45, 30); this.button16.TabIndex = 5; this.button16.Text = .; this.button16.UseVisualStyleBackColor = true; this.button16.Click += new System.EventHandler(this.button16_Click); / / panel2 / this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel2.Controls.Add(this.button16); this.panel2.Controls.Add(this.button17); this.panel2.Controls.Add(this.button15); this.panel2.Controls.Add(this.button14); this.panel2.Controls.Add(this.button13); this.panel2.Controls.Add(this.button12); this.panel2.Location = new System.Drawing.Point(144, 88); this.panel2.Name = panel2; this.panel2.Size = new System.Drawing.Size(120, 165); this.panel2.TabIndex = 7; this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); / / button17 / this.button17.Location = new System.Drawing.Point(3, 16); this.button17.Name = button17; this.button17.Size = new System.Drawing.Size(47, 100); this.button17.TabIndex = 6; this.button17.Text = +; this.button17.UseVisualStyleBackColor = true; this.button17.Click += new System.EventHandler(this.button17_Click); / / button15 / this.button15.Location = new System.Drawing.Point(56, 16); this.button15.Name = button15; this.button15.Size = new System.Drawing.Size(47, 30); this.button15.TabIndex = 4; this.button15.Text = -; this.button15.UseVisualStyleBackColor = true; this.button15.Click += new System.EventHandler(this.button15_Click); / / button14 / this.button14.Location = new System.Drawing.Point(56, 51); this.button14.Name = button14; this.button14.Size = new System.Drawing.Size(47, 30); this.button14.TabIndex = 3; this.button14.Text = *; this.button14.UseVisualStyleBackColor = true; this.button14.Click += new System.EventHandler(this.button14_Click); / / button13 / this.button13.Location = new System.Drawing.Point(56, 85); this.button13.Name = button13; this.button13.Size = new System.Drawing.Size(47, 30); this.button13.TabIndex = 2; this.button13.Text = /; this.button13.UseVisualStyleBackColor = true; this.button13.Click += new System.EventHandler(this.button13_Click); / / button12 / this.button12.Location = new System.Drawing.Point(56, 121); this.button12.Name = button12; this.button12.Size = new System.Drawing.Size(47, 30); this.button12.TabIndex = 1; this.button12.Text = =; this.button12.UseVisualStyleBackColor = true; this.button12.Click += new System.EventHandler(this.button12_Click); / / button18 / this.button18.Location = new System.Drawing.Point(5, 0); this.button18.Name = button18; this.button18.Size = new System.Drawing.Size(52, 30); this.button18.TabIndex = 1; this.button18.Text = C; this.button18.UseVisualStyleBackColor = true; this.button18.Click += new System.EventHandler(this.C_Click); / / button23 / this.button23.Location = new System.Drawing.Point(5, 36); this.button23.Name = button23; this.button23.Size = new System.Drawing.Size(52, 30); this.button23.TabIndex = 9; this.button23.Text = C/A; this.button23.UseVisualStyleBackColor = true; this.button23.Click += new System.EventHandler(this.button23_Click); / / panel3 / this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel3.Controls.Add(this.button23); this.panel3.Controls.Add(this.button18); this.panel3.Location = new System.Drawing.Point(270, 88); this.panel3.Name = panel3; this.panel3.Size = new System.Drawing.Size(69, 80); this.panel3.TabIndex = 18; / / button19 / this.button19.Location = new System.Drawing.Point(277, 176); this.button19.Name = button19; this.button19.Size = new System.Drawing.Size(52, 30); this.button19.TabIndex = 19; this.button19.Text = OFF; this.button19.UseVisualStyleBackColor = true; this.button19.Click += new System.EventHandler(this.button19_Click); / / Form1 / this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(347, 253); this.Controls.Add(this.button19); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Controls.Add(this.textBox1); this.KeyPreview = true; this.Name = Form1; this.Text = Caiculator; this.Load += new System.EventHandler(this.Form1_Load); this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); this.panel3.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); #endregion private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Button button10; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button17; private System.Windows.Forms.Button button16; private System.Windows.Forms.Button button15; private System.Windows.Forms.Button button14; private System.Windows.Forms.Button button13; private System.Windows.Forms.Button button12; private System.Windows.Forms.Button button18; private System.Windows.Forms.Button button23; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button19; 计算机功能程序: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Syst

温馨提示

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

评论

0/150

提交评论