写一个模拟袖珍计算器程序,要求switch语句, 输入:10*15 输出:10.00*15.00=150.00 紧急求援,谢!

2022-08-07 社会 110阅读
using System; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Data; 
using System.Runtime.InteropServices; 
using System.IO; 

namespace 计算器 

///  
/// Form1 的摘要说明。 
/// 
 
public class Form1 : System.Windows.Forms.Form 

private System.Windows.Forms.TextBox textBox1; 
private System.Windows.Forms.Label label1; 
private System.Windows.Forms.Button button1; 
private System.Windows.Forms.Button button2; 
private System.Windows.Forms.Button button3; 
private System.Windows.Forms.Button button4; 
private System.Windows.Forms.Button button5; 
private System.Windows.Forms.Button button6; 
private System.Windows.Forms.Button button7; 
private System.Windows.Forms.Button button8; 
private System.Windows.Forms.Button button9; 
private System.Windows.Forms.Button button11; 
private System.Windows.Forms.Button button12; 
private System.Windows.Forms.Button button13; 
private System.Windows.Forms.Button button14; 
private System.Windows.Forms.Button button15; 
private System.Windows.Forms.Button button16; 
private System.Windows.Forms.Button button17; 
private System.Windows.Forms.Button button10; 
private System.Windows.Forms.Button button18; 
private System.Windows.Forms.Button button19; 
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1; 
private System.Windows.Forms.PictureBox pictureBox1; 
private System.ComponentModel.Container components = null; 

public Form1() 

// 
// Windows 窗体设计器支持所必需的 
// 
InitializeComponent(); 

// 
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码 
// 


///  
/// 清理所有正在使用的资源。 
/// 
 
protected override void Dispose( bool disposing ) 

if( disposing ) 

if (components != null) 

components.Dispose(); 


base.Dispose( disposing ); 


#region Windows 窗体设计器生成的代码 
///  
/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
/// 此方法的内容。 
/// 
 
private void InitializeComponent() 

System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); 
this.textBox1 = new System.Windows.Forms.TextBox(); 
this.label1 = new System.Windows.Forms.Label(); 
this.button1 = new System.Windows.Forms.Button(); 
this.button2 = new System.Windows.Forms.Button(); 
this.button3 = new System.Windows.Forms.Button(); 
this.button4 = new System.Windows.Forms.Button(); 
this.button5 = new System.Windows.Forms.Button(); 
this.button6 = new System.Windows.Forms.Button(); 
this.button7 = new System.Windows.Forms.Button(); 
this.button8 = new System.Windows.Forms.Button(); 
this.button9 = new System.Windows.Forms.Button(); 
this.button11 = new System.Windows.Forms.Button(); 
this.button12 = new System.Windows.Forms.Button(); 
this.button13 = new System.Windows.Forms.Button(); 
this.button14 = new System.Windows.Forms.Button(); 
this.button15 = new System.Windows.Forms.Button(); 
this.button16 = new System.Windows.Forms.Button(); 
this.button17 = new System.Windows.Forms.Button(); 
this.button10 = new System.Windows.Forms.Button(); 
this.button18 = new System.Windows.Forms.Button(); 
this.button19 = new System.Windows.Forms.Button(); 
this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer(); 
this.pictureBox1 = new System.Windows.Forms.PictureBox(); 
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit(); 
this.SuspendLayout(); 
// 
// textBox1 
// 
this.textBox1.Location = new System.Drawing.Point(112, 32); 
this.textBox1.Name = "textBox1"; 
this.textBox1.Size = new System.Drawing.Size(240, 29); 
this.textBox1.TabIndex = 0; 
this.textBox1.Text = ""; 
// 
// label1 
// 
this.label1.Font = new System.Drawing.Font("楷体_GB2312", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
this.label1.Location = new System.Drawing.Point(24, 40); 
this.label1.Name = "label1"; 
this.label1.Size = new System.Drawing.Size(72, 40); 
this.label1.TabIndex = 1; 
this.label1.Text = "结果"; 
// 
// button1 
// 
this.button1.Location = new System.Drawing.Point(24, 168); 
this.button1.Name = "button1"; 
this.button1.Size = new System.Drawing.Size(40, 32); 
this.button1.TabIndex = 3; 
this.button1.Text = "1"; 
this.button1.Click += new System.EventHandler(this.button1_Click); 
// 
// button2 
// 
this.button2.Location = new System.Drawing.Point(88, 168); 
this.button2.Name = "button2"; 
this.button2.Size = new System.Drawing.Size(40, 32); 
this.button2.TabIndex = 4; 
this.button2.Text = "2"; 
this.button2.Click += new System.EventHandler(this.button2_Click); 
// 
// button3 
// 
this.button3.Location = new System.Drawing.Point(152, 168); 
this.button3.Name = "button3"; 
this.button3.Size = new System.Drawing.Size(40, 32); 
this.button3.TabIndex = 5; 
this.button3.Text = "3"; 
this.button3.Click += new System.EventHandler(this.button3_Click); 
// 
// button4 
// 
this.button4.Location = new System.Drawing.Point(24, 216); 
this.button4.Name = "button4"; 
this.button4.Size = new System.Drawing.Size(40, 32); 
this.button4.TabIndex = 6; 
this.button4.Text = "4"; 
this.button4.Click += new System.EventHandler(this.button4_Click); 
// 
// button5 
// 
this.button5.Location = new System.Drawing.Point(88, 216); 
this.button5.Name = "button5"; 
this.button5.Size = new System.Drawing.Size(40, 32); 
this.button5.TabIndex = 7; 
this.button5.Text = "5"; 
this.button5.Click += new System.EventHandler(this.button5_Click); 
// 
// button6 
// 
this.button6.Location = new System.Drawing.Point(152, 216); 
this.button6.Name = "button6"; 
this.button6.Size = new System.Drawing.Size(40, 32); 
this.button6.TabIndex = 8; 
this.button6.Text = "6"; 
this.button6.Click += new System.EventHandler(this.button6_Click); 
// 
// button7 
// 
this.button7.Location = new System.Drawing.Point(24, 264); 
this.button7.Name = "button7"; 
this.button7.Size = new System.Drawing.Size(40, 32); 
this.button7.TabIndex = 9; 
this.button7.Text = "7"; 
this.button7.Click += new System.EventHandler(this.button7_Click); 
// 
// button8 
// 
this.button8.Location = new System.Drawing.Point(88, 264); 
this.button8.Name = "button8"; 
this.button8.Size = new System.Drawing.Size(40, 32); 
this.button8.TabIndex = 10; 
this.button8.Text = "8"; 
this.button8.Click += new System.EventHandler(this.button8_Click); 
// 
// button9 
// 
this.button9.Location = new System.Drawing.Point(152, 264); 
this.button9.Name = "button9"; 
this.button9.Size = new System.Drawing.Size(40, 32); 
this.button9.TabIndex = 11; 
this.button9.Text = "9"; 
this.button9.Click += new System.EventHandler(this.button9_Click); 
// 
// button11 
// 
this.button11.Location = new System.Drawing.Point(152, 320); 
this.button11.Name = "button11"; 
this.button11.Size = new System.Drawing.Size(40, 32); 
this.button11.TabIndex = 13; 
this.button11.Text = "="; 
this.button11.Click += new System.EventHandler(this.button11_Click); 
// 
// button12 
// 
this.button12.Location = new System.Drawing.Point(152, 120); 
this.button12.Name = "button12"; 
this.button12.Size = new System.Drawing.Size(40, 32); 
this.button12.TabIndex = 14; 
this.button12.Text = "/"; 
this.button12.Click += new System.EventHandler(this.button12_Click); 
// 
// button13 
// 
this.button13.Location = new System.Drawing.Point(208, 120); 
this.button13.Name = "button13"; 
this.button13.Size = new System.Drawing.Size(40, 32); 
this.button13.TabIndex = 15; 
this.button13.Text = "*"; 
this.button13.Click += new System.EventHandler(this.button13_Click); 
// 
// button14 
// 
this.button14.Location = new System.Drawing.Point(208, 168); 
this.button14.Name = "button14"; 
this.button14.Size = new System.Drawing.Size(40, 32); 
this.button14.TabIndex = 16; 
this.button14.Text = "-"; 
this.button14.Click += new System.EventHandler(this.button14_Click); 
// 
// button15 
// 
this.button15.Location = new System.Drawing.Point(208, 216); 
this.button15.Name = "button15"; 
this.button15.Size = new System.Drawing.Size(40, 32); 
this.button15.TabIndex = 17; 
this.button15.Text = "+"; 
this.button15.Click += new System.EventHandler(this.button15_Click); 
// 
// button16 
//
字数有限制…………
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com