📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace MyCalcApp
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnC;
private System.Windows.Forms.Button btndot;
private System.Windows.Forms.Button btn0;
private System.Windows.Forms.Button btn3;
private System.Windows.Forms.Button btn2;
private System.Windows.Forms.Button btn1;
private System.Windows.Forms.Button btn6;
private System.Windows.Forms.Button btn5;
private System.Windows.Forms.Button btn4;
private System.Windows.Forms.Button btn9;
private System.Windows.Forms.Button btn8;
private System.Windows.Forms.Button btn7;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btnDiv;
private System.Windows.Forms.Button btnMul;
private System.Windows.Forms.Button btnSub;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnResult;
private System.Windows.Forms.Button btnSqr;
private System.Windows.Forms.Button btnExp;
private System.Windows.Forms.Button btnLog;
private MyNumberBox.MyNumberBox numBox;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.btn9 = new System.Windows.Forms.Button();
this.btn8 = new System.Windows.Forms.Button();
this.btn7 = new System.Windows.Forms.Button();
this.btn6 = new System.Windows.Forms.Button();
this.btn5 = new System.Windows.Forms.Button();
this.btn4 = new System.Windows.Forms.Button();
this.btn3 = new System.Windows.Forms.Button();
this.btn2 = new System.Windows.Forms.Button();
this.btn1 = new System.Windows.Forms.Button();
this.btnC = new System.Windows.Forms.Button();
this.btndot = new System.Windows.Forms.Button();
this.btn0 = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.btnLog = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.btnExp = new System.Windows.Forms.Button();
this.btnSub = new System.Windows.Forms.Button();
this.btnSqr = new System.Windows.Forms.Button();
this.btnMul = new System.Windows.Forms.Button();
this.btnResult = new System.Windows.Forms.Button();
this.btnDiv = new System.Windows.Forms.Button();
this.numBox = new MyNumberBox.MyNumberBox();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btn9,
this.btn8,
this.btn7,
this.btn6,
this.btn5,
this.btn4,
this.btn3,
this.btn2,
this.btn1,
this.btnC,
this.btndot,
this.btn0});
this.panel1.Location = new System.Drawing.Point(0, 56);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(184, 176);
this.panel1.TabIndex = 5;
//
// btn9
//
this.btn9.Location = new System.Drawing.Point(132, 16);
this.btn9.Name = "btn9";
this.btn9.Size = new System.Drawing.Size(40, 25);
this.btn9.TabIndex = 14;
this.btn9.Text = "9";
this.btn9.Click += new System.EventHandler(this.btn9_Click);
//
// btn8
//
this.btn8.Location = new System.Drawing.Point(76, 16);
this.btn8.Name = "btn8";
this.btn8.Size = new System.Drawing.Size(40, 25);
this.btn8.TabIndex = 13;
this.btn8.Text = "8";
this.btn8.Click += new System.EventHandler(this.btn8_Click);
//
// btn7
//
this.btn7.Location = new System.Drawing.Point(20, 16);
this.btn7.Name = "btn7";
this.btn7.Size = new System.Drawing.Size(40, 25);
this.btn7.TabIndex = 12;
this.btn7.Text = "7";
this.btn7.Click += new System.EventHandler(this.btn7_Click);
//
// btn6
//
this.btn6.Location = new System.Drawing.Point(132, 56);
this.btn6.Name = "btn6";
this.btn6.Size = new System.Drawing.Size(40, 25);
this.btn6.TabIndex = 11;
this.btn6.Text = "6";
this.btn6.Click += new System.EventHandler(this.btn6_Click);
//
// btn5
//
this.btn5.Location = new System.Drawing.Point(76, 56);
this.btn5.Name = "btn5";
this.btn5.Size = new System.Drawing.Size(40, 25);
this.btn5.TabIndex = 10;
this.btn5.Text = "5";
this.btn5.Click += new System.EventHandler(this.btn5_Click);
//
// btn4
//
this.btn4.Location = new System.Drawing.Point(20, 56);
this.btn4.Name = "btn4";
this.btn4.Size = new System.Drawing.Size(40, 25);
this.btn4.TabIndex = 9;
this.btn4.Text = "4";
this.btn4.Click += new System.EventHandler(this.btn4_Click);
//
// btn3
//
this.btn3.Location = new System.Drawing.Point(132, 96);
this.btn3.Name = "btn3";
this.btn3.Size = new System.Drawing.Size(40, 25);
this.btn3.TabIndex = 8;
this.btn3.Text = "3";
this.btn3.Click += new System.EventHandler(this.btn3_Click);
//
// btn2
//
this.btn2.Location = new System.Drawing.Point(76, 96);
this.btn2.Name = "btn2";
this.btn2.Size = new System.Drawing.Size(40, 25);
this.btn2.TabIndex = 7;
this.btn2.Text = "2";
this.btn2.Click += new System.EventHandler(this.btn2_Click);
//
// btn1
//
this.btn1.Location = new System.Drawing.Point(20, 96);
this.btn1.Name = "btn1";
this.btn1.Size = new System.Drawing.Size(40, 25);
this.btn1.TabIndex = 6;
this.btn1.Text = "1";
this.btn1.Click += new System.EventHandler(this.btn1_Click);
//
// btnC
//
this.btnC.Location = new System.Drawing.Point(132, 136);
this.btnC.Name = "btnC";
this.btnC.Size = new System.Drawing.Size(40, 25);
this.btnC.TabIndex = 5;
this.btnC.Text = "C";
this.btnC.Click += new System.EventHandler(this.btnC_Click);
//
// btndot
//
this.btndot.Location = new System.Drawing.Point(76, 136);
this.btndot.Name = "btndot";
this.btndot.Size = new System.Drawing.Size(40, 25);
this.btndot.TabIndex = 4;
this.btndot.Text = ".";
this.btndot.Click += new System.EventHandler(this.btndot_Click);
//
// btn0
//
this.btn0.Location = new System.Drawing.Point(20, 136);
this.btn0.Name = "btn0";
this.btn0.Size = new System.Drawing.Size(40, 25);
this.btn0.TabIndex = 3;
this.btn0.Text = "0";
this.btn0.Click += new System.EventHandler(this.btn0_Click);
//
// panel2
//
this.panel2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btnLog,
this.btnAdd,
this.btnExp,
this.btnSub,
this.btnSqr,
this.btnMul,
this.btnResult,
this.btnDiv});
this.panel2.Location = new System.Drawing.Point(192, 56);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(112, 176);
this.panel2.TabIndex = 6;
//
// btnLog
//
this.btnLog.Location = new System.Drawing.Point(64, 18);
this.btnLog.Name = "btnLog";
this.btnLog.Size = new System.Drawing.Size(40, 25);
this.btnLog.TabIndex = 12;
this.btnLog.Text = "Log";
this.btnLog.Click += new System.EventHandler(this.btnLog_Click);
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(8, 18);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(40, 25);
this.btnAdd.TabIndex = 11;
this.btnAdd.Text = "+";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnExp
//
this.btnExp.Location = new System.Drawing.Point(64, 58);
this.btnExp.Name = "btnExp";
this.btnExp.Size = new System.Drawing.Size(40, 25);
this.btnExp.TabIndex = 10;
this.btnExp.Text = "Exp";
this.btnExp.Click += new System.EventHandler(this.btnExp_Click);
//
// btnSub
//
this.btnSub.Location = new System.Drawing.Point(8, 59);
this.btnSub.Name = "btnSub";
this.btnSub.Size = new System.Drawing.Size(40, 25);
this.btnSub.TabIndex = 9;
this.btnSub.Text = "-";
this.btnSub.Click += new System.EventHandler(this.btnSub_Click);
//
// btnSqr
//
this.btnSqr.Location = new System.Drawing.Point(64, 99);
this.btnSqr.Name = "btnSqr";
this.btnSqr.Size = new System.Drawing.Size(40, 25);
this.btnSqr.TabIndex = 8;
this.btnSqr.Text = "Sqrt";
this.btnSqr.Click += new System.EventHandler(this.btnSqr_Click);
//
// btnMul
//
this.btnMul.Location = new System.Drawing.Point(8, 99);
this.btnMul.Name = "btnMul";
this.btnMul.Size = new System.Drawing.Size(40, 25);
this.btnMul.TabIndex = 7;
this.btnMul.Text = "×";
this.btnMul.Click += new System.EventHandler(this.btnMul_Click);
//
// btnResult
//
this.btnResult.Location = new System.Drawing.Point(64, 136);
this.btnResult.Name = "btnResult";
this.btnResult.Size = new System.Drawing.Size(40, 25);
this.btnResult.TabIndex = 6;
this.btnResult.Text = "=";
this.btnResult.Click += new System.EventHandler(this.btnResult_Click);
//
// btnDiv
//
this.btnDiv.Location = new System.Drawing.Point(8, 136);
this.btnDiv.Name = "btnDiv";
this.btnDiv.Size = new System.Drawing.Size(40, 25);
this.btnDiv.TabIndex = 5;
this.btnDiv.Text = "÷";
this.btnDiv.Click += new System.EventHandler(this.btnDiv_Click);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -