[C#]组合框设计windows加减乘除简单计算器应用
来源:互联网 发布:金蝶进销存软件多少钱 编辑:程序博客网 时间:2024/05/21 12:52
组合框使用方法,按照下面图片上提示,设计一个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 combox{ public partial class Form1 : Form { public Form1() { InitializeComponent(); label1.Text = "="; button1.Text = "选择不同运算符进行计算"; comboBox1.Items.Add("+"); comboBox1.Items.Add("-"); comboBox1.Items.Add("*"); comboBox1.Items.Add("/"); } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { float a, b, c; a = Convert.ToSingle(textBox1.Text); b = Convert.ToSingle(textBox2.Text); if (comboBox1.Text== "+") { c = a + b; textBox3.Text = c.ToString(); } else if (comboBox1.Text == "-") { c = a - b; textBox3.Text = c.ToString() ; } else if (comboBox1.Text == "*") { c = a * b; textBox3.Text = c.ToString(); } else { c = a / b; textBox3.Text = c.ToString(); } } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } }}
运行:
0 0
- [C#]组合框设计windows加减乘除简单计算器应用
- 栈的应用--简单计算器---加减乘除
- 【简单计算器】实现加减乘除
- 简单的计算器------加减乘除
- 设计模式的简单应用【加减乘除】
- 一个简单的加减乘除计算器
- vs2015/mfc加减乘除简单计算器
- windows计算器简单UI设计(java)
- 用C语言设计一个简单计算器
- C语言简单程序设计,计算器的设计
- JAVA设计计算器——加减乘除
- java 简单的计算器(加减乘除)
- Java实现简单计算器的加减乘除功能
- C#实现简单的加减乘除计算器
- 用php简单实现加减乘除计算器
- html+js实现的简单计算器(加减乘除)
- 32位汇编写简单加减乘除计算器
- 简单加减乘除括号的计算器实现
- LeetCode Longest Palindromic Substring
- 从Cell类型转变成数据型
- ubuntu12.04下搭建ftp服务器
- Cairo-dock
- 今后这个博客不再更新,迁移至http://liujiacai.net/
- [C#]组合框设计windows加减乘除简单计算器应用
- mysql binlog日志自动清理及手动删除
- Spelling Error
- SMU 1106 - 凸多边形的最优三角剖分问题(区间DP)
- 微信公众平台接入Java实例,结合BAE
- 揭开Socket编程的面纱
- js中用cssText设置css样式
- SEH+Dump程序无崩溃
- java-Eclipse-replace(替换)-split(分割)运用