📄 cqzc.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace cwgl
{
public partial class cqzc : Form
{
public TextBox tx;
public cqzc(TextBox tx1)
{
InitializeComponent();
tx = tx1;
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
textBox2.Text = "0";
}
private void button1_Click(object sender, EventArgs e)
{
tx.Text = textBox3.Text.ToString().Trim();
this.Close();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
try
{
if (float.Parse(this.textBox1.Text.ToString().Trim()) >= 0)
{
float t1 = float.Parse(textBox1.Text.ToString().Trim());
float t2 = float.Parse(textBox2.Text.ToString().Trim());
float all = t1 + t2;
textBox3.Text = all.ToString().Trim();
}
else
{
MessageBox.Show("请输入正整数","提示");
this.textBox1.Text = "0";
}
}
catch (FormatException e1)
{
MessageBox.Show(e1.Message,"请输入数字");
this.textBox1.Text = "0";
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
try
{
if (float.Parse(this.textBox2.Text.ToString().Trim()) >= 0)
{
float t1 = float.Parse(textBox1.Text.ToString().Trim());
float t2 = float.Parse(textBox2.Text.ToString().Trim());
float all = t1 + t2;
textBox3.Text = all.ToString().Trim();
}
else
{
MessageBox.Show("请输入正整数","提示");
this.textBox2.Text = "0";
}
}
catch (FormatException e2)
{
MessageBox.Show(e2.Message,"请输入数字");
this.textBox2.Text = "0";
}
}
private void cqzc_Load(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -