|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Calculator
{
/// <summary>
/// Description r�sum�e de Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button1;
/// <summary>
/// Variable n�cessaire au concepteur.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Requis pour la prise en charge du Concepteur Windows Forms
//
InitializeComponent();
//
// TODO : ajoutez le code du constructeur apr�s l'appel � InitializeComponent
//
}
/// <summary>
/// Nettoyage des ressources utilis�es.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Code g�n�r� par le Concepteur Windows Form
/// <summary>
/// M�thode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette m�thode avec l'�diteur de code.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.textBox1.Location = new System.Drawing.Point(5, 32);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(470, 345);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "# Type or select a formula \r\n# and then press [Calc]\r\n\r\n";
this.textBox1.WordWrap = false;
//
// panel1
//
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.comboBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(5, 5);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(470, 27);
this.panel1.TabIndex = 3;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(424, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(40, 23);
this.button1.TabIndex = 3;
this.button1.Text = "Calc";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// comboBox1
//
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBox1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.comboBox1.Items.AddRange(new object[] {
"1+4",
"1+2*3",
"100+4"});
this.comboBox1.Location = new System.Drawing.Point(0, 2);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(420, 23);
this.comboBox1.TabIndex = 1;
this.comboBox1.Text = "1+2*3";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(480, 382);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.panel1);
this.DockPadding.All = 5;
this.Name = "Form1";
this.Text = "Form1";
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Point d'entr�e principal de l'application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
Parser p = new Parser(comboBox1.Text);
p.Parse();
textBox1.AppendText(">" + comboBox1.Text + "\r\n"
+ p.result.ToString() + "\r\n");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.