C#實(shí)現(xiàn)簡(jiǎn)易計(jì)算器功能(2)(窗體應(yīng)用)
本文實(shí)例為大家分享了C#實(shí)現(xiàn)簡(jiǎn)易計(jì)算器功能第二部分的具體代碼,供大家參考,具體內(nèi)容如下
初始化,實(shí)現(xiàn)四則運(yùn)算
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsAppCalculator { ? ? public partial class Form1 : Form ? ? { ? ? ? ? double number1 = 0; ? ? ? ? double number2 = 0; ? ? ? ? double result; ? ? ? ? int inputNumber; ? ? ? ? enum Operator { none, plus, minus, multiplication, division}//判斷運(yùn)算法則 ? ? ? ? Operator mode = Operator.none; ? ? ? ? bool isequal = false; ? ? ? ? public Form1() ? ? ? ? { ? ? ? ? ? ? InitializeComponent(); ? ? ? ? } ? ? ? ? private void num1_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 1; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? ? ? //number1 = number1 * 10 + 1; ? ? ? ? ? ? //labelout.Text = Convert.ToString(number1); ? ? ? ? ?? ? ? ? ? } ? ? ? ? private void num2_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 2; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num3_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 3; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num4_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 4; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num5_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 5; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num6_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 6; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num7_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 7; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num8_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 8; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num9_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 9; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void num0_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? inputNumber = 0; ? ? ? ? ? ? WindowsFormsAppCalculator(inputNumber); ? ? ? ? } ? ? ? ? private void Form1_Load(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? labelout.Text = Convert.ToString(number1); ? ? ? ? } ? ? ? ? private void clean_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? cleanAll(); ? ? ? ? } ? ? ? ? public void WindowsFormsAppCalculator(int an) //不懂這段怎么來(lái)的 ? ? ? ? { ? ? ? ? ? ? if (mode == Operator.none) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? number1 = number1 * 10 + an; ? ? ? ? ? ? ? ? labelout.Text = Convert.ToString(number1); ? ? ? ? ? ? } ? ? ? ? ? ? else ? ? ? ? ? ? { ? ? ? ? ? ? ? ? number2 = number2 * 10 + an; ? ? ? ? ? ? ? ? labelout.Text = Convert.ToString(number2); ? ? ? ? ? ? } ? ? ? ? } ? ? ? ? private void plus_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? mode = Operator.plus; ? ? ? ? ? ? switchmode(); ? ? ? ? ? ? //isequal = true; ? ? ? ? ?} ? ? ? ? private void minus_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? mode = Operator.minus; ? ? ? ? ? ? switchmode(); ? ? ? ? } ? ? ? ? private void multiplication_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? mode = Operator.multiplication; ? ? ? ? ? ? switchmode(); ? ? ? ? } ? ? ? ? private void division_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? mode = Operator.division; ? ? ? ? ? ? switchmode(); ? ? ? ? } ? ? ? ? private void equal_Click(object sender, EventArgs e) ? ? ? ? { ? ? ? ? ? ? switch (mode) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? case Operator.plus: ? ? ? ? ? ? ? ? ? ? ?result = number1 + number2; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case Operator.minus: ? ? ? ? ? ? ? ? ? ? ?result = number1 - number2; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case Operator.multiplication: ? ? ? ? ? ? ? ? ? ? ?result = number1 * number2; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case Operator.division: ? ? ? ? ? ? ? ? ? ? ?result = number1 / number2; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? } ? ? ? ? ? ?? ? ? ? ? ? ? isequal = true; ? ? ? ? ? ? labelbefore.Text = ""; ? ? ? ? ? ? labelmode.Text = ""; ? ? ? ? ? ? labelout.Text = Convert.ToString(result); ? ? ? ? ? ?? ? ? ? ? } ? ? ? ? public void cleanAll() ? ? ? ? { ? ? ? ? ? ? number1 = 0; ? ? ? ? ? ? number2 = 0; ? ? ? ? ? ? labelout.Text = Convert.ToString(number1); ? ? ? ? ? ? labelbefore.Text = ""; ? ? ? ? ? ? labelmode.Text = ""; ? ? ? ? ? ? isequal = false; ? ? ? ? ? ? mode = Operator.none; ? ? ? ? } ? ? ? ? public void switchmode() ? ? ? ? { ? ? ? ? ? ? switch (mode) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? case Operator.plus: ? ? ? ? ? ? ? ? ? ? labelmode.Text = "+"; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case Operator.minus: ? ? ? ? ? ? ? ? ? ? labelmode.Text = "-"; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case Operator.multiplication: ? ? ? ? ? ? ? ? ? ? labelmode.Text = "*"; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case Operator.division: ? ? ? ? ? ? ? ? ? ? labelmode.Text = "/"; ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? } ? ? ? ? ? ? //isequal = true; ? ? ? ? ? ? //cleanAll(); ? ? ? ? ? ? ? ? ? ? ? ? labelbefore.Text = Convert.ToString(number1); ? ? ? ? ? ? labelout.Text = Convert.ToString(number2); ? ? ? ? } ? ? } }
namespace WindowsFormsAppCalculator { ? ? partial class Form1 ? ? { ? ? ? ? /// <summary> ? ? ? ? /// 必需的設(shè)計(jì)器變量。 ? ? ? ? /// </summary> ? ? ? ? private System.ComponentModel.IContainer components = null; ? ? ? ? /// <summary> ? ? ? ? /// 清理所有正在使用的資源。 ? ? ? ? /// </summary> ? ? ? ? /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param> ? ? ? ? protected override void Dispose(bool disposing) ? ? ? ? { ? ? ? ? ? ? if (disposing && (components != null)) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? components.Dispose(); ? ? ? ? ? ? } ? ? ? ? ? ? base.Dispose(disposing); ? ? ? ? } ? ? ? ? #region Windows 窗體設(shè)計(jì)器生成的代碼 ? ? ? ? /// <summary> ? ? ? ? /// 設(shè)計(jì)器支持所需的方法 - 不要修改 ? ? ? ? /// 使用代碼編輯器修改此方法的內(nèi)容。 ? ? ? ? /// </summary> ? ? ? ? private void InitializeComponent() ? ? ? ? { ? ? ? ? ? ? this.labelout = new System.Windows.Forms.Label(); ? ? ? ? ? ? this.labelbefore = new System.Windows.Forms.Label(); ? ? ? ? ? ? this.labelmode = new System.Windows.Forms.Label(); ? ? ? ? ? ? this.num1 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num6 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num8 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num7 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num5 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num4 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num9 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num2 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num3 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.num0 = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.clean = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.minus = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.multiplication = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.division = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.plus = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.equal = new System.Windows.Forms.Button(); ? ? ? ? ? ? this.SuspendLayout(); ? ? ? ? ? ? //? ? ? ? ? ? ? // labelout ? ? ? ? ? ? //? ? ? ? ? ? ? this.labelout.Font = new System.Drawing.Font("宋體", 25.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); ? ? ? ? ? ? this.labelout.Location = new System.Drawing.Point(26, 111); ? ? ? ? ? ? this.labelout.Name = "labelout"; ? ? ? ? ? ? this.labelout.Size = new System.Drawing.Size(463, 49); ? ? ? ? ? ? this.labelout.TabIndex = 0; ? ? ? ? ? ? this.labelout.TextAlign = System.Drawing.ContentAlignment.BottomRight; ? ? ? ? ? ? //? ? ? ? ? ? ? // labelbefore ? ? ? ? ? ? //? ? ? ? ? ? ? this.labelbefore.Font = new System.Drawing.Font("宋體", 22.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); ? ? ? ? ? ? this.labelbefore.Location = new System.Drawing.Point(27, 9); ? ? ? ? ? ? this.labelbefore.Name = "labelbefore"; ? ? ? ? ? ? this.labelbefore.Size = new System.Drawing.Size(463, 43); ? ? ? ? ? ? this.labelbefore.TabIndex = 1; ? ? ? ? ? ? this.labelbefore.TextAlign = System.Drawing.ContentAlignment.BottomRight; ? ? ? ? ? ? //? ? ? ? ? ? ? // labelmode ? ? ? ? ? ? //? ? ? ? ? ? ? this.labelmode.Font = new System.Drawing.Font("宋體", 22.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); ? ? ? ? ? ? this.labelmode.Location = new System.Drawing.Point(28, 61); ? ? ? ? ? ? this.labelmode.Name = "labelmode"; ? ? ? ? ? ? this.labelmode.Size = new System.Drawing.Size(463, 39); ? ? ? ? ? ? this.labelmode.TabIndex = 2; ? ? ? ? ? ? this.labelmode.TextAlign = System.Drawing.ContentAlignment.BottomRight; ? ? ? ? ? ? //? ? ? ? ? ? ? // num1 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num1.Location = new System.Drawing.Point(35, 199); ? ? ? ? ? ? this.num1.Name = "num1"; ? ? ? ? ? ? this.num1.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num1.TabIndex = 3; ? ? ? ? ? ? this.num1.Text = "1"; ? ? ? ? ? ? this.num1.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num1.Click += new System.EventHandler(this.num1_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num6 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num6.Location = new System.Drawing.Point(218, 253); ? ? ? ? ? ? this.num6.Name = "num6"; ? ? ? ? ? ? this.num6.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num6.TabIndex = 6; ? ? ? ? ? ? this.num6.Text = "6"; ? ? ? ? ? ? this.num6.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num6.Click += new System.EventHandler(this.num6_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num8 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num8.Location = new System.Drawing.Point(130, 312); ? ? ? ? ? ? this.num8.Name = "num8"; ? ? ? ? ? ? this.num8.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num8.TabIndex = 7; ? ? ? ? ? ? this.num8.Text = "8"; ? ? ? ? ? ? this.num8.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num8.Click += new System.EventHandler(this.num8_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num7 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num7.Location = new System.Drawing.Point(35, 312); ? ? ? ? ? ? this.num7.Name = "num7"; ? ? ? ? ? ? this.num7.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num7.TabIndex = 8; ? ? ? ? ? ? this.num7.Text = "7"; ? ? ? ? ? ? this.num7.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num7.Click += new System.EventHandler(this.num7_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num5 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num5.Location = new System.Drawing.Point(130, 253); ? ? ? ? ? ? this.num5.Name = "num5"; ? ? ? ? ? ? this.num5.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num5.TabIndex = 9; ? ? ? ? ? ? this.num5.Text = "5"; ? ? ? ? ? ? this.num5.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num5.Click += new System.EventHandler(this.num5_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num4 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num4.Location = new System.Drawing.Point(35, 253); ? ? ? ? ? ? this.num4.Name = "num4"; ? ? ? ? ? ? this.num4.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num4.TabIndex = 10; ? ? ? ? ? ? this.num4.Text = "4"; ? ? ? ? ? ? this.num4.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num4.Click += new System.EventHandler(this.num4_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num9 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num9.Location = new System.Drawing.Point(218, 312); ? ? ? ? ? ? this.num9.Name = "num9"; ? ? ? ? ? ? this.num9.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num9.TabIndex = 11; ? ? ? ? ? ? this.num9.Text = "9"; ? ? ? ? ? ? this.num9.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num9.Click += new System.EventHandler(this.num9_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num2 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num2.Location = new System.Drawing.Point(130, 199); ? ? ? ? ? ? this.num2.Name = "num2"; ? ? ? ? ? ? this.num2.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num2.TabIndex = 12; ? ? ? ? ? ? this.num2.Text = "2"; ? ? ? ? ? ? this.num2.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num2.Click += new System.EventHandler(this.num2_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num3 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num3.Location = new System.Drawing.Point(218, 199); ? ? ? ? ? ? this.num3.Name = "num3"; ? ? ? ? ? ? this.num3.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num3.TabIndex = 13; ? ? ? ? ? ? this.num3.Text = "3"; ? ? ? ? ? ? this.num3.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num3.Click += new System.EventHandler(this.num3_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // num0 ? ? ? ? ? ? //? ? ? ? ? ? ? this.num0.Location = new System.Drawing.Point(130, 372); ? ? ? ? ? ? this.num0.Name = "num0"; ? ? ? ? ? ? this.num0.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.num0.TabIndex = 14; ? ? ? ? ? ? this.num0.Text = "0"; ? ? ? ? ? ? this.num0.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.num0.Click += new System.EventHandler(this.num0_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // clean ? ? ? ? ? ? //? ? ? ? ? ? ? this.clean.Location = new System.Drawing.Point(387, 199); ? ? ? ? ? ? this.clean.Name = "clean"; ? ? ? ? ? ? this.clean.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.clean.TabIndex = 15; ? ? ? ? ? ? this.clean.Text = "清除"; ? ? ? ? ? ? this.clean.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.clean.Click += new System.EventHandler(this.clean_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // minus ? ? ? ? ? ? //? ? ? ? ? ? ? this.minus.Location = new System.Drawing.Point(305, 253); ? ? ? ? ? ? this.minus.Name = "minus"; ? ? ? ? ? ? this.minus.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.minus.TabIndex = 16; ? ? ? ? ? ? this.minus.Text = "-"; ? ? ? ? ? ? this.minus.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.minus.Click += new System.EventHandler(this.minus_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // multiplication ? ? ? ? ? ? //? ? ? ? ? ? ? this.multiplication.Location = new System.Drawing.Point(305, 312); ? ? ? ? ? ? this.multiplication.Name = "multiplication"; ? ? ? ? ? ? this.multiplication.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.multiplication.TabIndex = 17; ? ? ? ? ? ? this.multiplication.Text = "*"; ? ? ? ? ? ? this.multiplication.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.multiplication.Click += new System.EventHandler(this.multiplication_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // division ? ? ? ? ? ? //? ? ? ? ? ? ? this.division.Location = new System.Drawing.Point(305, 372); ? ? ? ? ? ? this.division.Name = "division"; ? ? ? ? ? ? this.division.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.division.TabIndex = 18; ? ? ? ? ? ? this.division.Text = "/"; ? ? ? ? ? ? this.division.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.division.Click += new System.EventHandler(this.division_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // plus ? ? ? ? ? ? //? ? ? ? ? ? ? this.plus.Location = new System.Drawing.Point(305, 199); ? ? ? ? ? ? this.plus.Name = "plus"; ? ? ? ? ? ? this.plus.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.plus.TabIndex = 19; ? ? ? ? ? ? this.plus.Text = "+"; ? ? ? ? ? ? this.plus.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.plus.Click += new System.EventHandler(this.plus_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // equal ? ? ? ? ? ? //? ? ? ? ? ? ? this.equal.Location = new System.Drawing.Point(218, 372); ? ? ? ? ? ? this.equal.Name = "equal"; ? ? ? ? ? ? this.equal.Size = new System.Drawing.Size(71, 41); ? ? ? ? ? ? this.equal.TabIndex = 20; ? ? ? ? ? ? this.equal.Text = "="; ? ? ? ? ? ? this.equal.UseVisualStyleBackColor = true; ? ? ? ? ? ? this.equal.Click += new System.EventHandler(this.equal_Click); ? ? ? ? ? ? //? ? ? ? ? ? ? // Form1 ? ? ? ? ? ? //? ? ? ? ? ? ? this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); ? ? ? ? ? ? this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; ? ? ? ? ? ? this.ClientSize = new System.Drawing.Size(502, 466); ? ? ? ? ? ? this.Controls.Add(this.equal); ? ? ? ? ? ? this.Controls.Add(this.plus); ? ? ? ? ? ? this.Controls.Add(this.division); ? ? ? ? ? ? this.Controls.Add(this.multiplication); ? ? ? ? ? ? this.Controls.Add(this.minus); ? ? ? ? ? ? this.Controls.Add(this.clean); ? ? ? ? ? ? this.Controls.Add(this.num0); ? ? ? ? ? ? this.Controls.Add(this.num3); ? ? ? ? ? ? this.Controls.Add(this.num2); ? ? ? ? ? ? this.Controls.Add(this.num9); ? ? ? ? ? ? this.Controls.Add(this.num4); ? ? ? ? ? ? this.Controls.Add(this.num5); ? ? ? ? ? ? this.Controls.Add(this.num7); ? ? ? ? ? ? this.Controls.Add(this.num8); ? ? ? ? ? ? this.Controls.Add(this.num6); ? ? ? ? ? ? this.Controls.Add(this.num1); ? ? ? ? ? ? this.Controls.Add(this.labelmode); ? ? ? ? ? ? this.Controls.Add(this.labelbefore); ? ? ? ? ? ? this.Controls.Add(this.labelout); ? ? ? ? ? ? this.Name = "Form1"; ? ? ? ? ? ? this.Text = "Form1"; ? ? ? ? ? ? this.Load += new System.EventHandler(this.Form1_Load); ? ? ? ? ? ? this.ResumeLayout(false); ? ? ? ? } ? ? ? ? #endregion ? ? ? ? private System.Windows.Forms.Label labelout; ? ? ? ? private System.Windows.Forms.Label labelbefore; ? ? ? ? private System.Windows.Forms.Label labelmode; ? ? ? ? private System.Windows.Forms.Button num1; ? ? ? ? private System.Windows.Forms.Button num6; ? ? ? ? private System.Windows.Forms.Button num8; ? ? ? ? private System.Windows.Forms.Button num7; ? ? ? ? private System.Windows.Forms.Button num5; ? ? ? ? private System.Windows.Forms.Button num4; ? ? ? ? private System.Windows.Forms.Button num9; ? ? ? ? private System.Windows.Forms.Button num2; ? ? ? ? private System.Windows.Forms.Button num3; ? ? ? ? private System.Windows.Forms.Button num0; ? ? ? ? private System.Windows.Forms.Button clean; ? ? ? ? private System.Windows.Forms.Button minus; ? ? ? ? private System.Windows.Forms.Button multiplication; ? ? ? ? private System.Windows.Forms.Button division; ? ? ? ? private System.Windows.Forms.Button plus; ? ? ? ? private System.Windows.Forms.Button equal; ? ? } }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- C#計(jì)算器編寫(xiě)代碼
- C#編寫(xiě)的windows計(jì)算器的實(shí)例代碼
- C#開(kāi)發(fā)簡(jiǎn)易winform計(jì)算器程序
- C#實(shí)現(xiàn)簡(jiǎn)單的計(jì)算器功能完整實(shí)例
- C#實(shí)現(xiàn)簡(jiǎn)單計(jì)算器功能
- C#實(shí)現(xiàn)簡(jiǎn)單加減乘除計(jì)算器
- C#實(shí)現(xiàn)Winform版計(jì)算器
- C#實(shí)現(xiàn)的簡(jiǎn)單整數(shù)四則運(yùn)算計(jì)算器功能示例
- c#入門(mén)之實(shí)現(xiàn)簡(jiǎn)易存款利息計(jì)算器示例
- C# WinForm程序設(shè)計(jì)簡(jiǎn)單計(jì)算器
相關(guān)文章
c# 在windows中操作IIS設(shè)置FTP服務(wù)器的示例
這篇文章主要介紹了c# 在windows中操作IIS設(shè)置FTP服務(wù)器的示例,幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下2021-03-03C#刪除只讀文件或文件夾(解決File.Delete無(wú)法刪除文件)
這篇文章主要介紹了C#刪除只讀文件或文件夾(解決File.Delete無(wú)法刪除文件),需要的朋友可以參考下2015-09-09在web.config和app.config文件中增加自定義配置節(jié)點(diǎn)的方法
本篇文章主要是對(duì)在web.config和app.config文件中增加自定義配置節(jié)點(diǎn)的方法進(jìn)行了詳細(xì)的介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-01-01C# 中的 is 真的是越來(lái)越強(qiáng)大越來(lái)越語(yǔ)義化(推薦)
這篇文章主要介紹了C# 中的 is 真的是越來(lái)越強(qiáng)大越來(lái)越語(yǔ)義化,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-09-09詳解C#批量插入數(shù)據(jù)到Sqlserver中的四種方式
本文主要講解一下在Sqlserver中批量插入數(shù)據(jù)。文中大數(shù)據(jù)批量插入方式一和方式四盡量避免使用,而方式二和方式三都是非常高效的批量插入數(shù)據(jù)方式,需要的朋友可以看下2016-12-12VS里使用C#制作窗口應(yīng)用的項(xiàng)目實(shí)踐
C#窗體的頻率使用特別高,本文主要介紹了VS里使用C#制作窗口應(yīng)用的項(xiàng)目實(shí)踐,具有一定的參考價(jià)值,感興趣的可以了解一下2024-02-02