📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button16_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
textBox1.Text = "";
this.textBox1.Focus();
}
private void button11_Click(object sender, EventArgs e)
{
string str = textBox1.Text;
int i;
char c;
string a="", b="";
if (textBox1.Text != "")
{
for (i = 0; (str[i] >= '0' && str[i] <= '9') || str[i] == '.'; i++)
{
a = a + str[i];
}
c = str[i];
for (int t = i + 1; t < str.Length; t++)
{
b = b + str[t];
}
switch (c)
{
case '+':
textBox1.Text = Convert.ToString(Convert.ToDouble(a) + Convert.ToDouble(b));
break;
case '-':
textBox1.Text = Convert.ToString(Convert.ToDouble(a) - Convert.ToDouble(b));
break;
case '*':
textBox1.Text = Convert.ToString(Convert.ToDouble(a) * Convert.ToDouble(b));
break;
case '/':
textBox1.Text = Convert.ToString(Convert.ToDouble(a) / Convert.ToDouble(b));
break;
}
}
else
textBox1.Text = "请输入数字";
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button1.Text;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button2.Text;
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button3.Text;
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button4.Text;
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button5.Text;
}
private void button6_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button6.Text;
}
private void button7_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button7.Text;
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button8.Text;
}
private void button9_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button9.Text;
}
private void button10_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button10.Text;
}
private void button12_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button12.Text;
}
private void button13_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button13.Text;
}
private void button15_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button15.Text;
}
private void button14_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button14.Text;
}
private void button17_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button17.Text;
}
private void textBox1_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -