• 大小: 47KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: C#
  • 标签: C#  窗体程序  

资源简介

用C#做的一个简单的实现加减乘除的WINDOWS窗体程序计算器

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void bt_add_Click(object sender EventArgs e)
        {
            Double s1 = 0 s2 = 0result = 0;
            if (tb1.Text !=““) 
            {
                try
                {
                    s1 = Convert.ToDouble(tb1.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提示“); return; }
            }
            if (tb2.Text != ““) 
            {
                try
                {
                    s2 = Convert.ToDouble(tb2.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提示“); return; }
            }
            result = s1 + s2;
            tb_result.Text = result.ToString();
         
        }

        private void bt_subtract_Click(object sender EventArgs e)
        {
            Double s1 = 0 s2 = 0 result = 0;
            if (tb1.Text != ““)
            {
                try
                {
                    s1 = Convert.ToDouble(tb1.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提示“); return; }
            }
            if (tb2.Text != ““)
            {
                try
                {
                    s2 = Convert.ToDouble(tb2.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提示“); return; }
            }
            result = s1 - s2;
            tb_result.Text = result.ToString();
         
        }

        private void bt_multiply_Click(object sender EventArgs e)
        {
            Double s1 = 0 s2 = 0 result = 0;
            if (tb1.Text != ““)
            {
                try
                {
                    s1 = Convert.ToDouble(tb1.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提示“); return; }
            }
            if (tb2.Text != ““)
            {
                try
                {
                    s2 = Convert.ToDouble(tb2.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提示“); return; }
            }
            result = s1 * s2;
            tb_result.Text = result.ToString();
         
        }

        private void bt_divide_Click(object sender EventArgs e)
        {
            Double s1 = 0 s2 = 0 result = 0;
            if (tb1.Text != ““)
            {
                try
                {
                    s1 = Convert.ToDouble(tb1.Text.ToString().Trim());
                }
                catch { MessageBox.Show(“请输入正确的数字!“ “提

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      11264  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe

     文件      26112  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb

     文件      11600  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe

     文件        490  2010-03-17 22:39  简易计算器\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest

     文件       3680  2015-01-06 10:14  简易计算器\WindowsFormsApplication2\Form1.cs

     文件       6970  2015-01-06 10:14  简易计算器\WindowsFormsApplication2\Form1.Designer.cs

     文件       5817  2015-01-06 10:14  简易计算器\WindowsFormsApplication2\Form1.resx

     文件       4440  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6271  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        316  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\obj\x86\Debug\GenerateResource.read.1.tlog

     文件        798  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\obj\x86\Debug\GenerateResource.write.1.tlog

     文件        952  2015-01-06 10:13  简易计算器\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt

     文件      11264  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.exe

     文件        180  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Form1.resources

     文件      26112  2015-01-06 10:33  简易计算器\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.pdb

     文件        180  2015-01-06 09:50  简易计算器\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Properties.Resources.resources

     文件        952  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\obj\x86\Debug\简易计算器.csproj.FileListAbsolute.txt

     文件        505  2015-01-06 09:35  简易计算器\WindowsFormsApplication2\Program.cs

     文件       1392  2015-01-06 09:35  简易计算器\WindowsFormsApplication2\Properties\AssemblyInfo.cs

     文件       2899  2015-01-06 09:35  简易计算器\WindowsFormsApplication2\Properties\Resources.Designer.cs

     文件       5612  2015-01-06 09:35  简易计算器\WindowsFormsApplication2\Properties\Resources.resx

     文件       1110  2015-01-06 09:35  简易计算器\WindowsFormsApplication2\Properties\Settings.Designer.cs

     文件        249  2015-01-06 09:35  简易计算器\WindowsFormsApplication2\Properties\Settings.settings

     文件       3707  2015-01-06 09:50  简易计算器\WindowsFormsApplication2\简易计算器.csproj

     文件        896  2015-01-06 10:33  简易计算器\WindowsFormsApplication2.sln

    ..A..H.     45056  2015-01-06 10:34  简易计算器\WindowsFormsApplication2.suo

     目录          0  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\obj\x86\Debug\TempPE

     目录          0  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\obj\x86\Debug

     目录          0  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\bin\Debug

     目录          0  2015-01-06 10:34  简易计算器\WindowsFormsApplication2\obj\x86

............此处省略8个文件信息

评论

共有 条评论