作者在 2010-07-17 13:29:13 发布以下内容
using System;
using System.Linq;
using System.Windows.Forms;
using 常用小软件试制作;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Collections;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using 常用小软件试制作;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Collections;
using System.IO;
namespace WindowsFormsApplication1
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new loadForm());
}
}
}
namespace 常用小软件试制作
{
partial class loadForm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new loadForm());
}
}
}
namespace 常用小软件试制作
{
partial class loadForm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.btn_chr = new System.Windows.Forms.Button();
this.btn_calculator = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.OldLace;
this.panel1.Controls.Add(this.label1);
this.panel1.Location = new System.Drawing.Point(2, 2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(423, 87);
this.panel1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(141, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(125, 12);
this.label1.TabIndex = 0;
this.label1.Text = "试一试制作常用小软件";
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Gold;
this.panel2.Controls.Add(this.button1);
this.panel2.Controls.Add(this.btn_chr);
this.panel2.Controls.Add(this.btn_calculator);
this.panel2.Location = new System.Drawing.Point(3, 90);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(422, 265);
this.panel2.TabIndex = 1;
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(300, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(122, 39);
this.button1.TabIndex = 2;
this.button1.Text = "记事闹钟";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btn_chr
//
this.btn_chr.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_chr.Location = new System.Drawing.Point(157, 0);
this.btn_chr.Name = "btn_chr";
this.btn_chr.Size = new System.Drawing.Size(146, 39);
this.btn_chr.TabIndex = 1;
this.btn_chr.Text = "记事本";
this.btn_chr.UseVisualStyleBackColor = true;
this.btn_chr.Click += new System.EventHandler(this.btn_chr_Click);
//
// btn_calculator
//
this.btn_calculator.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_calculator.Location = new System.Drawing.Point(-1, 0);
this.btn_calculator.Name = "btn_calculator";
this.btn_calculator.Size = new System.Drawing.Size(162, 39);
this.btn_calculator.TabIndex = 0;
this.btn_calculator.Text = "计算器";
this.btn_calculator.UseVisualStyleBackColor = true;
this.btn_calculator.Click += new System.EventHandler(this.button1_Click);
//
// loadForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(424, 357);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "loadForm";
this.Text = "load....";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.btn_chr = new System.Windows.Forms.Button();
this.btn_calculator = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.OldLace;
this.panel1.Controls.Add(this.label1);
this.panel1.Location = new System.Drawing.Point(2, 2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(423, 87);
this.panel1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(141, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(125, 12);
this.label1.TabIndex = 0;
this.label1.Text = "试一试制作常用小软件";
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Gold;
this.panel2.Controls.Add(this.button1);
this.panel2.Controls.Add(this.btn_chr);
this.panel2.Controls.Add(this.btn_calculator);
this.panel2.Location = new System.Drawing.Point(3, 90);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(422, 265);
this.panel2.TabIndex = 1;
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(300, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(122, 39);
this.button1.TabIndex = 2;
this.button1.Text = "记事闹钟";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btn_chr
//
this.btn_chr.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_chr.Location = new System.Drawing.Point(157, 0);
this.btn_chr.Name = "btn_chr";
this.btn_chr.Size = new System.Drawing.Size(146, 39);
this.btn_chr.TabIndex = 1;
this.btn_chr.Text = "记事本";
this.btn_chr.UseVisualStyleBackColor = true;
this.btn_chr.Click += new System.EventHandler(this.btn_chr_Click);
//
// btn_calculator
//
this.btn_calculator.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_calculator.Location = new System.Drawing.Point(-1, 0);
this.btn_calculator.Name = "btn_calculator";
this.btn_calculator.Size = new System.Drawing.Size(162, 39);
this.btn_calculator.TabIndex = 0;
this.btn_calculator.Text = "计算器";
this.btn_calculator.UseVisualStyleBackColor = true;
this.btn_calculator.Click += new System.EventHandler(this.button1_Click);
//
// loadForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(424, 357);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "loadForm";
this.Text = "load....";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btn_calculator;
private System.Windows.Forms.Button btn_chr;
private System.Windows.Forms.Button button1;
}
public partial class loadForm : Form
{
public loadForm()
{
InitializeComponent();
}
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btn_calculator;
private System.Windows.Forms.Button btn_chr;
private System.Windows.Forms.Button button1;
}
public partial class loadForm : Form
{
public loadForm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
calculator f = new calculator();
f.Show();
}
{
calculator f = new calculator();
f.Show();
}
private void btn_chr_Click(object sender, EventArgs e)
{
chronicleform f = new chronicleform();
f.Show();
}
{
chronicleform f = new chronicleform();
f.Show();
}
private void button1_Click_1(object sender, EventArgs e)
{
Notetimeform f = new Notetimeform();
f.Show();
}
}
partial class calculator
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
{
Notetimeform f = new Notetimeform();
f.Show();
}
}
partial class calculator
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btn_1 = new System.Windows.Forms.Button();
this.btn_2 = new System.Windows.Forms.Button();
this.btn_3 = new System.Windows.Forms.Button();
this.btn_4 = new System.Windows.Forms.Button();
this.btn_5 = new System.Windows.Forms.Button();
this.btn_6 = new System.Windows.Forms.Button();
this.btn_7 = new System.Windows.Forms.Button();
this.btn_8 = new System.Windows.Forms.Button();
this.btn_9 = new System.Windows.Forms.Button();
this.btn_sign = new System.Windows.Forms.Button();
this.btn_dot = new System.Windows.Forms.Button();
this.btn_0 = new System.Windows.Forms.Button();
this.btn_add = new System.Windows.Forms.Button();
this.btn_mul = new System.Windows.Forms.Button();
this.btn_sub = new System.Windows.Forms.Button();
this.btn_div = new System.Windows.Forms.Button();
this.btn_sqrt = new System.Windows.Forms.Button();
this.btn_sqr = new System.Windows.Forms.Button();
this.btn_rev = new System.Windows.Forms.Button();
this.btn_equ = new System.Windows.Forms.Button();
this.txtShow = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btn_1
//
this.btn_1.Location = new System.Drawing.Point(12, 65);
this.btn_1.Name = "btn_1";
this.btn_1.Size = new System.Drawing.Size(57, 23);
this.btn_1.TabIndex = 0;
//this.btn_1.Tag = "1";
this.btn_1.Text = "1";
this.btn_1.UseVisualStyleBackColor = true;
this.btn_1.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_2
//
this.btn_2.Location = new System.Drawing.Point(88, 65);
this.btn_2.Name = "btn_2";
this.btn_2.Size = new System.Drawing.Size(62, 23);
this.btn_2.TabIndex = 1;
// this.btn_2.Tag = "2";
this.btn_2.Text = "2";
this.btn_2.UseVisualStyleBackColor = true;
this.btn_2.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_3
//
this.btn_3.Location = new System.Drawing.Point(167, 65);
this.btn_3.Name = "btn_3";
this.btn_3.Size = new System.Drawing.Size(67, 23);
this.btn_3.TabIndex = 2;
//this.btn_3.Tag = "3";
this.btn_3.Text = "3";
this.btn_3.UseVisualStyleBackColor = true;
this.btn_3.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_4
//
this.btn_4.Location = new System.Drawing.Point(12, 108);
this.btn_4.Name = "btn_4";
this.btn_4.Size = new System.Drawing.Size(57, 23);
this.btn_4.TabIndex = 3;
//this.btn_4.Tag = "4";
this.btn_4.Text = "4";
this.btn_4.UseVisualStyleBackColor = true;
this.btn_4.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_5
//
this.btn_5.Location = new System.Drawing.Point(88, 108);
this.btn_5.Name = "btn_5";
this.btn_5.Size = new System.Drawing.Size(62, 23);
this.btn_5.TabIndex = 4;
//this.btn_5.Tag = "5";
this.btn_5.Text = "5";
this.btn_5.UseVisualStyleBackColor = true;
this.btn_5.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_6
//
this.btn_6.Location = new System.Drawing.Point(167, 108);
this.btn_6.Name = "btn_6";
this.btn_6.Size = new System.Drawing.Size(67, 23);
this.btn_6.TabIndex = 5;
this.btn_6.Text = "6";
//this.btn_6.Tag = "6";
this.btn_6.UseVisualStyleBackColor = true;
this.btn_6.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_7
//
this.btn_7.Location = new System.Drawing.Point(12, 146);
this.btn_7.Name = "btn_7";
this.btn_7.Size = new System.Drawing.Size(57, 23);
this.btn_7.TabIndex = 6;
this.btn_7.Text = "7";
// this.btn_7.Tag = "7";
this.btn_7.UseVisualStyleBackColor = true;
this.btn_7.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_8
//
this.btn_8.Location = new System.Drawing.Point(88, 146);
this.btn_8.Name = "btn_8";
this.btn_8.Size = new System.Drawing.Size(62, 23);
this.btn_8.TabIndex = 7;
this.btn_8.Text = "8";
//this.btn_8.Tag = "8";
this.btn_8.UseVisualStyleBackColor = true;
this.btn_8.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_9
//
this.btn_9.Location = new System.Drawing.Point(167, 146);
this.btn_9.Name = "btn_9";
this.btn_9.Size = new System.Drawing.Size(67, 23);
this.btn_9.TabIndex = 8;
this.btn_9.Text = "9";
// this.btn_9.Tag = "9";
this.btn_9.UseVisualStyleBackColor = true;
this.btn_9.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_sign
//
this.btn_sign.Location = new System.Drawing.Point(12, 187);
this.btn_sign.Name = "btn_sign";
this.btn_sign.Size = new System.Drawing.Size(57, 23);
this.btn_sign.TabIndex = 9;
this.btn_sign.Text = "+/-";
this.btn_sign.UseVisualStyleBackColor = true;
//
// btn_dot
//
this.btn_dot.Location = new System.Drawing.Point(167, 187);
this.btn_dot.Name = "btn_dot";
this.btn_dot.Size = new System.Drawing.Size(67, 23);
this.btn_dot.TabIndex = 10;
this.btn_dot.Text = ".";
this.btn_dot.UseVisualStyleBackColor = true;
//
// btn_0
//
this.btn_0.Location = new System.Drawing.Point(88, 187);
this.btn_0.Name = "btn_0";
this.btn_0.Size = new System.Drawing.Size(62, 23);
this.btn_0.TabIndex = 11;
this.btn_0.Text = "0";
this.btn_0.Tag = "0";
this.btn_0.UseVisualStyleBackColor = true;
this.btn_0.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_add
//
this.btn_add.Location = new System.Drawing.Point(263, 65);
this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(67, 23);
this.btn_add.TabIndex = 12;
this.btn_add.Text = "+";
this.btn_add.UseVisualStyleBackColor = true;
this.btn_add.Click += new System.EventHandler(this.btn_add_Click);
//
// btn_mul
//
this.btn_mul.Location = new System.Drawing.Point(263, 146);
this.btn_mul.Name = "btn_mul";
this.btn_mul.Size = new System.Drawing.Size(67, 23);
this.btn_mul.TabIndex = 13;
this.btn_mul.Text = "*";
this.btn_mul.UseVisualStyleBackColor = true;
this.btn_mul.Click += new System.EventHandler(this.btn_mul_Click);
//
// btn_sub
//
this.btn_sub.Location = new System.Drawing.Point(263, 108);
this.btn_sub.Name = "btn_sub";
this.btn_sub.Size = new System.Drawing.Size(67, 23);
this.btn_sub.TabIndex = 14;
this.btn_sub.Text = "-";
this.btn_sub.UseVisualStyleBackColor = true;
this.btn_sub.Click += new System.EventHandler(this.btn_sub_Click);
//
// btn_div
//
this.btn_div.Location = new System.Drawing.Point(263, 187);
this.btn_div.Name = "btn_div";
this.btn_div.Size = new System.Drawing.Size(67, 23);
this.btn_div.TabIndex = 15;
this.btn_div.Text = "/";
this.btn_div.UseVisualStyleBackColor = true;
this.btn_div.Click += new System.EventHandler(this.btn_div_Click);
//
// btn_sqrt
//
this.btn_sqrt.Location = new System.Drawing.Point(349, 65);
this.btn_sqrt.Name = "btn_sqrt";
this.btn_sqrt.Size = new System.Drawing.Size(65, 23);
this.btn_sqrt.TabIndex = 16;
this.btn_sqrt.Text = "√";
this.btn_sqrt.UseVisualStyleBackColor = true;
this.btn_sqrt.Click += new System.EventHandler(this.btn_sqrt_Click);
//
// btn_sqr
//
this.btn_sqr.Location = new System.Drawing.Point(349, 108);
this.btn_sqr.Name = "btn_sqr";
this.btn_sqr.Size = new System.Drawing.Size(65, 23);
this.btn_sqr.TabIndex = 17;
this.btn_sqr.Text = "x^2";
this.btn_sqr.UseVisualStyleBackColor = true;
this.btn_sqr.Click += new System.EventHandler(this.btn_sqr_Click);
//
// btn_rev
//
this.btn_rev.Location = new System.Drawing.Point(349, 146);
this.btn_rev.Name = "btn_rev";
this.btn_rev.Size = new System.Drawing.Size(65, 23);
this.btn_rev.TabIndex = 18;
this.btn_rev.Text = "1?x";
this.btn_rev.UseVisualStyleBackColor = true;
this.btn_rev.Click += new System.EventHandler(this.btn_rev_Click);
//
// btn_equ
//
this.btn_equ.Location = new System.Drawing.Point(349, 187);
this.btn_equ.Name = "btn_equ";
this.btn_equ.Size = new System.Drawing.Size(65, 23);
this.btn_equ.TabIndex = 19;
this.btn_equ.Text = "=";
this.btn_equ.UseVisualStyleBackColor = true;
this.btn_equ.Click += new System.EventHandler(this.btn_equ_Click);
//
// txtShow
//
this.txtShow.BackColor = System.Drawing.Color.WhiteSmoke;
this.txtShow.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtShow.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtShow.Location = new System.Drawing.Point(12, 12);
this.txtShow.Name = "txtShow";
this.txtShow.Size = new System.Drawing.Size(402, 29);
this.txtShow.TabIndex = 20;
this.txtShow.Text = "\r\n";
//
// calculator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(426, 242);
this.Controls.Add(this.txtShow);
this.Controls.Add(this.btn_equ);
this.Controls.Add(this.btn_rev);
this.Controls.Add(this.btn_sqr);
this.Controls.Add(this.btn_sqrt);
this.Controls.Add(this.btn_div);
this.Controls.Add(this.btn_sub);
this.Controls.Add(this.btn_mul);
this.Controls.Add(this.btn_add);
this.Controls.Add(this.btn_0);
this.Controls.Add(this.btn_dot);
this.Controls.Add(this.btn_sign);
this.Controls.Add(this.btn_9);
this.Controls.Add(this.btn_8);
this.Controls.Add(this.btn_7);
this.Controls.Add(this.btn_6);
this.Controls.Add(this.btn_5);
this.Controls.Add(this.btn_4);
this.Controls.Add(this.btn_3);
this.Controls.Add(this.btn_2);
this.Controls.Add(this.btn_1);
this.Name = "calculator";
this.Text = "calculator";
this.ResumeLayout(false);
this.PerformLayout();
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btn_1 = new System.Windows.Forms.Button();
this.btn_2 = new System.Windows.Forms.Button();
this.btn_3 = new System.Windows.Forms.Button();
this.btn_4 = new System.Windows.Forms.Button();
this.btn_5 = new System.Windows.Forms.Button();
this.btn_6 = new System.Windows.Forms.Button();
this.btn_7 = new System.Windows.Forms.Button();
this.btn_8 = new System.Windows.Forms.Button();
this.btn_9 = new System.Windows.Forms.Button();
this.btn_sign = new System.Windows.Forms.Button();
this.btn_dot = new System.Windows.Forms.Button();
this.btn_0 = new System.Windows.Forms.Button();
this.btn_add = new System.Windows.Forms.Button();
this.btn_mul = new System.Windows.Forms.Button();
this.btn_sub = new System.Windows.Forms.Button();
this.btn_div = new System.Windows.Forms.Button();
this.btn_sqrt = new System.Windows.Forms.Button();
this.btn_sqr = new System.Windows.Forms.Button();
this.btn_rev = new System.Windows.Forms.Button();
this.btn_equ = new System.Windows.Forms.Button();
this.txtShow = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btn_1
//
this.btn_1.Location = new System.Drawing.Point(12, 65);
this.btn_1.Name = "btn_1";
this.btn_1.Size = new System.Drawing.Size(57, 23);
this.btn_1.TabIndex = 0;
//this.btn_1.Tag = "1";
this.btn_1.Text = "1";
this.btn_1.UseVisualStyleBackColor = true;
this.btn_1.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_2
//
this.btn_2.Location = new System.Drawing.Point(88, 65);
this.btn_2.Name = "btn_2";
this.btn_2.Size = new System.Drawing.Size(62, 23);
this.btn_2.TabIndex = 1;
// this.btn_2.Tag = "2";
this.btn_2.Text = "2";
this.btn_2.UseVisualStyleBackColor = true;
this.btn_2.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_3
//
this.btn_3.Location = new System.Drawing.Point(167, 65);
this.btn_3.Name = "btn_3";
this.btn_3.Size = new System.Drawing.Size(67, 23);
this.btn_3.TabIndex = 2;
//this.btn_3.Tag = "3";
this.btn_3.Text = "3";
this.btn_3.UseVisualStyleBackColor = true;
this.btn_3.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_4
//
this.btn_4.Location = new System.Drawing.Point(12, 108);
this.btn_4.Name = "btn_4";
this.btn_4.Size = new System.Drawing.Size(57, 23);
this.btn_4.TabIndex = 3;
//this.btn_4.Tag = "4";
this.btn_4.Text = "4";
this.btn_4.UseVisualStyleBackColor = true;
this.btn_4.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_5
//
this.btn_5.Location = new System.Drawing.Point(88, 108);
this.btn_5.Name = "btn_5";
this.btn_5.Size = new System.Drawing.Size(62, 23);
this.btn_5.TabIndex = 4;
//this.btn_5.Tag = "5";
this.btn_5.Text = "5";
this.btn_5.UseVisualStyleBackColor = true;
this.btn_5.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_6
//
this.btn_6.Location = new System.Drawing.Point(167, 108);
this.btn_6.Name = "btn_6";
this.btn_6.Size = new System.Drawing.Size(67, 23);
this.btn_6.TabIndex = 5;
this.btn_6.Text = "6";
//this.btn_6.Tag = "6";
this.btn_6.UseVisualStyleBackColor = true;
this.btn_6.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_7
//
this.btn_7.Location = new System.Drawing.Point(12, 146);
this.btn_7.Name = "btn_7";
this.btn_7.Size = new System.Drawing.Size(57, 23);
this.btn_7.TabIndex = 6;
this.btn_7.Text = "7";
// this.btn_7.Tag = "7";
this.btn_7.UseVisualStyleBackColor = true;
this.btn_7.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_8
//
this.btn_8.Location = new System.Drawing.Point(88, 146);
this.btn_8.Name = "btn_8";
this.btn_8.Size = new System.Drawing.Size(62, 23);
this.btn_8.TabIndex = 7;
this.btn_8.Text = "8";
//this.btn_8.Tag = "8";
this.btn_8.UseVisualStyleBackColor = true;
this.btn_8.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_9
//
this.btn_9.Location = new System.Drawing.Point(167, 146);
this.btn_9.Name = "btn_9";
this.btn_9.Size = new System.Drawing.Size(67, 23);
this.btn_9.TabIndex = 8;
this.btn_9.Text = "9";
// this.btn_9.Tag = "9";
this.btn_9.UseVisualStyleBackColor = true;
this.btn_9.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_sign
//
this.btn_sign.Location = new System.Drawing.Point(12, 187);
this.btn_sign.Name = "btn_sign";
this.btn_sign.Size = new System.Drawing.Size(57, 23);
this.btn_sign.TabIndex = 9;
this.btn_sign.Text = "+/-";
this.btn_sign.UseVisualStyleBackColor = true;
//
// btn_dot
//
this.btn_dot.Location = new System.Drawing.Point(167, 187);
this.btn_dot.Name = "btn_dot";
this.btn_dot.Size = new System.Drawing.Size(67, 23);
this.btn_dot.TabIndex = 10;
this.btn_dot.Text = ".";
this.btn_dot.UseVisualStyleBackColor = true;
//
// btn_0
//
this.btn_0.Location = new System.Drawing.Point(88, 187);
this.btn_0.Name = "btn_0";
this.btn_0.Size = new System.Drawing.Size(62, 23);
this.btn_0.TabIndex = 11;
this.btn_0.Text = "0";
this.btn_0.Tag = "0";
this.btn_0.UseVisualStyleBackColor = true;
this.btn_0.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_add
//
this.btn_add.Location = new System.Drawing.Point(263, 65);
this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(67, 23);
this.btn_add.TabIndex = 12;
this.btn_add.Text = "+";
this.btn_add.UseVisualStyleBackColor = true;
this.btn_add.Click += new System.EventHandler(this.btn_add_Click);
//
// btn_mul
//
this.btn_mul.Location = new System.Drawing.Point(263, 146);
this.btn_mul.Name = "btn_mul";
this.btn_mul.Size = new System.Drawing.Size(67, 23);
this.btn_mul.TabIndex = 13;
this.btn_mul.Text = "*";
this.btn_mul.UseVisualStyleBackColor = true;
this.btn_mul.Click += new System.EventHandler(this.btn_mul_Click);
//
// btn_sub
//
this.btn_sub.Location = new System.Drawing.Point(263, 108);
this.btn_sub.Name = "btn_sub";
this.btn_sub.Size = new System.Drawing.Size(67, 23);
this.btn_sub.TabIndex = 14;
this.btn_sub.Text = "-";
this.btn_sub.UseVisualStyleBackColor = true;
this.btn_sub.Click += new System.EventHandler(this.btn_sub_Click);
//
// btn_div
//
this.btn_div.Location = new System.Drawing.Point(263, 187);
this.btn_div.Name = "btn_div";
this.btn_div.Size = new System.Drawing.Size(67, 23);
this.btn_div.TabIndex = 15;
this.btn_div.Text = "/";
this.btn_div.UseVisualStyleBackColor = true;
this.btn_div.Click += new System.EventHandler(this.btn_div_Click);
//
// btn_sqrt
//
this.btn_sqrt.Location = new System.Drawing.Point(349, 65);
this.btn_sqrt.Name = "btn_sqrt";
this.btn_sqrt.Size = new System.Drawing.Size(65, 23);
this.btn_sqrt.TabIndex = 16;
this.btn_sqrt.Text = "√";
this.btn_sqrt.UseVisualStyleBackColor = true;
this.btn_sqrt.Click += new System.EventHandler(this.btn_sqrt_Click);
//
// btn_sqr
//
this.btn_sqr.Location = new System.Drawing.Point(349, 108);
this.btn_sqr.Name = "btn_sqr";
this.btn_sqr.Size = new System.Drawing.Size(65, 23);
this.btn_sqr.TabIndex = 17;
this.btn_sqr.Text = "x^2";
this.btn_sqr.UseVisualStyleBackColor = true;
this.btn_sqr.Click += new System.EventHandler(this.btn_sqr_Click);
//
// btn_rev
//
this.btn_rev.Location = new System.Drawing.Point(349, 146);
this.btn_rev.Name = "btn_rev";
this.btn_rev.Size = new System.Drawing.Size(65, 23);
this.btn_rev.TabIndex = 18;
this.btn_rev.Text = "1?x";
this.btn_rev.UseVisualStyleBackColor = true;
this.btn_rev.Click += new System.EventHandler(this.btn_rev_Click);
//
// btn_equ
//
this.btn_equ.Location = new System.Drawing.Point(349, 187);
this.btn_equ.Name = "btn_equ";
this.btn_equ.Size = new System.Drawing.Size(65, 23);
this.btn_equ.TabIndex = 19;
this.btn_equ.Text = "=";
this.btn_equ.UseVisualStyleBackColor = true;
this.btn_equ.Click += new System.EventHandler(this.btn_equ_Click);
//
// txtShow
//
this.txtShow.BackColor = System.Drawing.Color.WhiteSmoke;
this.txtShow.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtShow.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtShow.Location = new System.Drawing.Point(12, 12);
this.txtShow.Name = "txtShow";
this.txtShow.Size = new System.Drawing.Size(402, 29);
this.txtShow.TabIndex = 20;
this.txtShow.Text = "\r\n";
//
// calculator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(426, 242);
this.Controls.Add(this.txtShow);
this.Controls.Add(this.btn_equ);
this.Controls.Add(this.btn_rev);
this.Controls.Add(this.btn_sqr);
this.Controls.Add(this.btn_sqrt);
this.Controls.Add(this.btn_div);
this.Controls.Add(this.btn_sub);
this.Controls.Add(this.btn_mul);
this.Controls.Add(this.btn_add);
this.Controls.Add(this.btn_0);
this.Controls.Add(this.btn_dot);
this.Controls.Add(this.btn_sign);
this.Controls.Add(this.btn_9);
this.Controls.Add(this.btn_8);
this.Controls.Add(this.btn_7);
this.Controls.Add(this.btn_6);
this.Controls.Add(this.btn_5);
this.Controls.Add(this.btn_4);
this.Controls.Add(this.btn_3);
this.Controls.Add(this.btn_2);
this.Controls.Add(this.btn_1);
this.Name = "calculator";
this.Text = "calculator";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_1;
private System.Windows.Forms.Button btn_2;
private System.Windows.Forms.Button btn_3;
private System.Windows.Forms.Button btn_4;
private System.Windows.Forms.Button btn_5;
private System.Windows.Forms.Button btn_6;
private System.Windows.Forms.Button btn_7;
private System.Windows.Forms.Button btn_8;
private System.Windows.Forms.Button btn_9;
private System.Windows.Forms.Button btn_sign;
private System.Windows.Forms.Button btn_dot;
private System.Windows.Forms.Button btn_0;
private System.Windows.Forms.Button btn_add;
private System.Windows.Forms.Button btn_mul;
private System.Windows.Forms.Button btn_sub;
private System.Windows.Forms.Button btn_div;
private System.Windows.Forms.Button btn_sqrt;
private System.Windows.Forms.Button btn_sqr;
private System.Windows.Forms.Button btn_rev;
private System.Windows.Forms.Button btn_equ;
private System.Windows.Forms.TextBox txtShow;
}
public partial class calculator : Form
{
public const int NULL = 0; // 定义操作码
public const int ADD = 1;
public const int SUB = 2;
public const int MUL = 3;
public const int DIV = 4;
public const int SQR = 5;
public const int SQRT = 6;
public const int NODOT = 0; // 定义是否点击了小数点
public const int HASDOT = 1;
private double res = 0; // 记录结果数
private double tmp = 0; // 当前输入的操作数
private int opt = NULL; // 记录操作码
private int dot = NODOT; // 记录是否点击了小数点
private int num = 0; // 记录输入操作数的个数
private int dotnum = 0; // 记录小数点部分的个数
public calculator()
{
InitializeComponent();
}
private void btn_0_Click(object sender, System.EventArgs e)
{
System.Windows.Forms.Button btnTmp;
double i;
private System.Windows.Forms.Button btn_2;
private System.Windows.Forms.Button btn_3;
private System.Windows.Forms.Button btn_4;
private System.Windows.Forms.Button btn_5;
private System.Windows.Forms.Button btn_6;
private System.Windows.Forms.Button btn_7;
private System.Windows.Forms.Button btn_8;
private System.Windows.Forms.Button btn_9;
private System.Windows.Forms.Button btn_sign;
private System.Windows.Forms.Button btn_dot;
private System.Windows.Forms.Button btn_0;
private System.Windows.Forms.Button btn_add;
private System.Windows.Forms.Button btn_mul;
private System.Windows.Forms.Button btn_sub;
private System.Windows.Forms.Button btn_div;
private System.Windows.Forms.Button btn_sqrt;
private System.Windows.Forms.Button btn_sqr;
private System.Windows.Forms.Button btn_rev;
private System.Windows.Forms.Button btn_equ;
private System.Windows.Forms.TextBox txtShow;
}
public partial class calculator : Form
{
public const int NULL = 0; // 定义操作码
public const int ADD = 1;
public const int SUB = 2;
public const int MUL = 3;
public const int DIV = 4;
public const int SQR = 5;
public const int SQRT = 6;
public const int NODOT = 0; // 定义是否点击了小数点
public const int HASDOT = 1;
private double res = 0; // 记录结果数
private double tmp = 0; // 当前输入的操作数
private int opt = NULL; // 记录操作码
private int dot = NODOT; // 记录是否点击了小数点
private int num = 0; // 记录输入操作数的个数
private int dotnum = 0; // 记录小数点部分的个数
public calculator()
{
InitializeComponent();
}
private void btn_0_Click(object sender, System.EventArgs e)
{
System.Windows.Forms.Button btnTmp;
double i;
btnTmp = sender as System.Windows.Forms.Button;
if (btnTmp != null)
{
if (dot == NODOT)
{
// 没有点击小数点
i = double.Parse(btnTmp.Text.ToString());
tmp = tmp * 10 + i;
txtShow.Text = tmp.ToString();
}
else
{
// 点击了小数点
dotnum++;
// 生成小数部分的新的数值
i = double.Parse(btnTmp.Text.ToString()) / System.Math.Pow(10, dotnum);
tmp = tmp + i;
txtShow.Text = tmp.ToString();
}
}
}
if (btnTmp != null)
{
if (dot == NODOT)
{
// 没有点击小数点
i = double.Parse(btnTmp.Text.ToString());
tmp = tmp * 10 + i;
txtShow.Text = tmp.ToString();
}
else
{
// 点击了小数点
dotnum++;
// 生成小数部分的新的数值
i = double.Parse(btnTmp.Text.ToString()) / System.Math.Pow(10, dotnum);
tmp = tmp + i;
txtShow.Text = tmp.ToString();
}
}
}
private void btn_equ_Click(object sender, EventArgs e)
{
// 生成结果
if (num == 0)
{
res = 0;
tmp = 0;
txtShow.Text = res.ToString();
return;
}
switch (opt)
{
// 加法
case ADD:
res = res + tmp;
break;
// 减法
case SUB:
res = res - tmp;
break;
// 乘法
case MUL:
res = res * tmp;
break;
// 除法
case DIV:
res = res / tmp;
break;
// 平方
case SQR:
res = tmp * tmp;
break;
// 平方根
case SQRT:
res = System.Math.Sqrt(tmp);
break;
default:
return;
}
txtShow.Text = res.ToString();
opt = NULL;
res = 0;
num = 0;
}
{
// 生成结果
if (num == 0)
{
res = 0;
tmp = 0;
txtShow.Text = res.ToString();
return;
}
switch (opt)
{
// 加法
case ADD:
res = res + tmp;
break;
// 减法
case SUB:
res = res - tmp;
break;
// 乘法
case MUL:
res = res * tmp;
break;
// 除法
case DIV:
res = res / tmp;
break;
// 平方
case SQR:
res = tmp * tmp;
break;
// 平方根
case SQRT:
res = System.Math.Sqrt(tmp);
break;
default:
return;
}
txtShow.Text = res.ToString();
opt = NULL;
res = 0;
num = 0;
}
private void btn_rev_Click(object sender, EventArgs e)
{
// 求倒数运算
tmp = 1 / tmp;
txtShow.Text = tmp.ToString();
}
{
// 求倒数运算
tmp = 1 / tmp;
txtShow.Text = tmp.ToString();
}
private void btn_div_Click(object sender, EventArgs e)
{
// 除法运算
opt = DIV;
if (num != 0)
{
if (tmp != 0)
res = res / tmp;
}
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
{
// 除法运算
opt = DIV;
if (num != 0)
{
if (tmp != 0)
res = res / tmp;
}
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
private void btn_mul_Click(object sender, EventArgs e)
{
// 乘法运算
opt = MUL;
if (num != 0)
res = res * tmp;
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
{
// 乘法运算
opt = MUL;
if (num != 0)
res = res * tmp;
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
private void btn_sub_Click(object sender, EventArgs e)
{
// 减法运算
opt = SUB;
if (num != 0)
res = res - tmp;
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
{
// 减法运算
opt = SUB;
if (num != 0)
res = res - tmp;
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
private void btn_add_Click(object sender, EventArgs e)
{
{
// 加法运算
opt = ADD;
if (num != 0)
res = res + tmp;
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
opt = ADD;
if (num != 0)
res = res + tmp;
else
res = tmp;
num++;
tmp = 0;
txtShow.Text = res.ToString();
}
private void btn_sqrt_Click(object sender, EventArgs e)
{
{
// 开方运算
if (tmp > 0)
{
tmp = Math.Sqrt(tmp);
txtShow.Text = tmp.ToString();
}
}
if (tmp > 0)
{
tmp = Math.Sqrt(tmp);
txtShow.Text = tmp.ToString();
}
}
private void btn_sqr_Click(object sender, EventArgs e)
{
// 平方运算
tmp = tmp * tmp;
txtShow.Text = tmp.ToString();
}
}
partial class chronicleform
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
{
// 平方运算
tmp = tmp * tmp;
txtShow.Text = tmp.ToString();
}
}
partial class chronicleform
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.保存ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.格式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.自动换行ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
this.帮助HTo
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.保存ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.格式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.自动换行ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
this.帮助HTo