用C#写计算器程序(三)
//基本的计算器
//蚕蛹 2001.11.26
//Using C#
//E-mail:sillnet@hotmail.com
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace wincalc
{
///
/// Summary description for calcForm.
///
public class calcForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button bClr;
private System.Windows.Forms.Button bDot;
private System.Windows.Forms.Button bPlus;
private System.Windows.Forms.Button bSub;
private System.Windows.Forms.Button bMul;
private System.Windows.Forms.Button bDiv;
private System.Windows.Forms.Button bEqu;
private System.Windows.Forms.TextBox txtCalc;
//以下是要添加的代码
//定义变量
Double dblAcc;
Double dblSec;
bool blnClear,blnFrstOpen;
String strOper;
//以上是添加的代码
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public calcForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
//以下是要添加的代码
//初始化设量
dblAcc=0;
dblSec=0;
blnFrstOpen=true;
blnClear=true;
strOper=new string('=',1);
//以上是添加的代码
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.bPlus = new System.Windows.Forms.Button();
this.bMul = new System.Windows.Forms.Button();
this.bDot = new System.Windows.Forms.Button();
this.txtCalc = new System.Windows.Forms.TextBox();
this.bClr = new System.Windows.Forms.Button();
this.bDiv = new System.Windows.Forms.Button();
this.bSub = new System.Windows.Forms.Button();