- Portal
- Community
- Forum Rules
- U-Labs Network
Account-Boerse
Downloade ohne Wartezeit und Geschwindigkeitsbeschränkung von Uploaded.net und Share-Online.biz!U-IMG
Schneller Speicherdienst für Bilder, die in Forenbeiträge eingefügt oder an Freunde gesendet werden können.
- Taschenrechner
- Programmierung
- Showroom
Thema: Taschenrechner
-
18.02.2012, 01:26 #1
Taschenrechner
Mich hat Jemand gefragt, ob ich ihm nen Taschenrechner code (er brauchts für die Berufsschule xD).
Hab mich mal eben hingesetzt und einen gemacht, der kann zwar nur die Grundrechenarten, aber wer das Prinzip verstanden hat, sollte auch die restlichen in dem Switchblock einbauen können...
Der Taschenrechner verhält sich genauso wie der Windows-Rechner.
Jede Zeile ist kommentiert, selbst blutige Anfänger sollten damit klarkommen, jammern ja immer so viele rum, es würde nix geben was mit Knuddels nix zu tun hat xD jetzt könnter damit anfangen zu coden.
Screen:
Hier der Source
CalculatorGUI.cs:
Spoiler:[highlight=csharp]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TR
{
public partial class CalculatorGUI : Form
{
#region Variablen definieren
private string op = null;
private string cached1 = null;
private string cached2 = null;
private bool startNewCalc = false;
#endregion
#region Konstruktor
public CalculatorGUI()
{
InitializeComponent();
}
#endregion
#region Eventhandler für Buttonklicks
private void btnNumeric_Click(object sender, EventArgs e)
{
//Nummer zum aktuellen Wert hinzufügen
addNewNumber((sender as Button).Text);
}
private void btnOp_Click(object sender, EventArgs e)
{
//Operator zur aktuellen Rechnung hinzufügen
addOperator((sender as Button).Text);
}
private void btnErg_Click(object sender, EventArgs e)
{
//Rechnung ausführen
calculate();
}
private void btnReset_Click(object sender, EventArgs e)
{
//Alle Felder und Werte zurücksetzen
reset();
}
private void btnResetActValue_Click(object sender, EventArgs e)
{
resetValue();
}
#endregion
#region Methoden für Berechnung
/// <summary>
/// Fügt der aktuellen Rechnung einen Operator hinzu
/// </summary>
/// <param name="operatr">Der Operator (string)</param>
private void addOperator(string operatr)
{
//Wenn der 2. Wert gesetzt ist, fügen wir diesen der Textboxc für den Rechenweg hinzu
if (cached2 != null)
tbxCalculation.Text += cached2;
//Sonst fügen wir den ersten Wert hinzu, da dieser als letztes gesetzt wurde
else
tbxCalculation.Text += cached1;
//Wenn der erste Wert schon gesetzt ist
if (cached1 != null)
{
//zeigen wir das auf der GUI an
tbxCalculation.Text += " " + operatr + " ";
//Und setzen den Operator
op = operatr;
}
//Wenn der 2. Wert schon gesetzt ist
if (cached2 != null)
//Führen wir die Rechnung schon aus, damit sie weitergeführt werden kann
calc(false);
//Da wir mitten in der Berechnung sind, starten wir keine neue Berechnung mehr
startNewCalc = false;
//Die Textbox mit dem aktuellen Rechenwert wird geleert
tbxActValue.ResetText();
}
/// <summary>
/// Rechnet die aktuelle Rechnung aus
/// </summary>
private void calculate()
{
//Rechnung ausführen
calc(true);
//Bei klick auf eine Zahl soll wieder eine neue Rechnung ausgeführt werden
startNewCalc = true;
}
/// <summary>
/// Fügt dem aktuellen Rechenwert eine Zahl an
/// </summary>
/// <param name="number">Die Zahl die angefügt werden soll</param>
private void addNewNumber(string number)
{
//Wenn eine neue Berechnung gestartet werden soll
if (startNewCalc)
{
//Die Textbox mit dem Rechenweg leeren
tbxCalculation.ResetText();
//Die Textbox mit dem Ergebnis leeren
tbxActValue.ResetText();
//Den boolschen Wert auf false setzen, damit beim nächsten Mal keine neue Berechnung mehr gestartet wird
startNewCalc = false;
}
//Wenn noch kein Operator eingegeben wurde, ist dies der erste Wert der Rechnung
if (op == null)
//Dieser wird an die Variable 'cached1' angehangen
cached1 += number;
//Andernfall ist es der zweite Wert
else
//Dieser wird an die Variable 'cached2' angehangen
cached2 += number;
//Damit der Uer sieht was er tut, wird das Ganze auch auf der GUI angezeigt
//In der Textbox mit dem aktuellen Rechenwert
tbxActValue.Text += number;
}
/// <summary>
/// Führt die Rechnung
/// </summary>
/// <param name="ergbuttonpressed">Gibt an ob der Ergebnisbutton gedrück wurde oder nicht</param>
private void calc(bool ergbuttonpressed)
{
//Rechenvariablen definieren
double value1 = 0;
double value2 = 0;
double erg = 0;
// Die Variablen von Strings in Gleitkommazahlen konvertieren
double.TryParse(cached1, out value1);
double.TryParse(cached2, out value2);
//Ermitteln welcher Operator benutzt werden soll
switch (op)
{
//Multiplikation
case "*":
erg = value1 * value2;
break;
//Division
case "/":
erg = value1 / value2;
break;
//Addition
case "+":
erg = value1 + value2;
break;
//Subtraktion
case "-":
erg = value1 - value2;
break;
//Unbekannter Operator
default:
erg = 0.00;
break;
}
//Wenn der Button mit dem '=' gedrückt wurde
if (ergbuttonpressed)
{
//Das Ergebnis in die Textbox schreiben
tbxActValue.Text = erg.ToString();
//Die Textbox mit dem Rechnenweg leeren
tbxCalculation.ResetText();
}
//Der erste gecachte wert wird durch das Ergebnis ersetzt um damit weiterzurechnen bei Bedarf
cached1 = erg.ToString();
//Der zweite gecachte Wert wird zurückgesetzt
cached2 = null;
}
#endregion
#region sonstiges
/// <summary>
/// Setzt alle Werte zurück
/// </summary>
private void reset()
{
//Gibt an, das beim nächsten Klick auf eine Zahl eine neue Rechnung gestartet werden soll
startNewCalc = true;
//Die Textbox mit dem Rechnenweg leeren
tbxCalculation.ResetText();
//Die Textbox mit dem Ergebnis leeren
tbxActValue.ResetText();
}
/// <summary>
/// Setzt den aktuellen Wert zurück
/// </summary>
private void resetValue()
{
//Box mit dem aktuellen Wert zurücksetzen
tbxActValue.ResetText();
//Wenn der Operator nicht gesetzt wurde
if (op == null)
//löschen wir den ersten Wert
cached1 = null;
else
//ansonsten den zweiten Wert
cached2 = null;
}
#endregion
}
}
[/highlight]
CalculatorGUI.Designer.cs:
Spoiler:[highlight=csharp]namespace TR
{
partial class CalculatorGUI
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typ eof(CalculatorGUI));
this.tlpNumerics = new System.Windows.Forms.TableLayoutPanel();
this.button11 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnResetActValue = new System.Windows.Forms.Button();
this.btnDiv = new System.Windows.Forms.Button();
this.btnMul = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.btnSub = new System.Windows.Forms.Button();
this.btnErg = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tbxCalculation = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.tbxActValue = new System.Windows.Forms.TextBox();
this.tlpNumerics.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// tlpNumerics
//
this.tlpNumerics.AutoSize = true;
this.tlpNumerics.BackColor = System.Drawing.Color.Transparent;
this.tlpNumerics.ColumnCount = 3;
this.tlpNumerics.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute, 35F));
this.tlpNumerics.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute, 35F));
this.tlpNumerics.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute, 35F));
this.tlpNumerics.Controls.Add(this.button11, 0, 3);
this.tlpNumerics.Controls.Add(this.button1, 1, 0);
this.tlpNumerics.Controls.Add(this.button2, 0, 0);
this.tlpNumerics.Controls.Add(this.button3, 2, 0);
this.tlpNumerics.Controls.Add(this.button4, 0, 1);
this.tlpNumerics.Controls.Add(this.button12, 2, 3);
this.tlpNumerics.Controls.Add(this.button5, 1, 1);
this.tlpNumerics.Controls.Add(this.button7, 0, 2);
this.tlpNumerics.Controls.Add(this.button8, 1, 2);
this.tlpNumerics.Controls.Add(this.button9, 2, 2);
this.tlpNumerics.Controls.Add(this.button6, 2, 1);
this.tlpNumerics.Location = new System.Drawing.Point(5, 57);
this.tlpNumerics.Margin = new System.Windows.Forms.Padding(0);
this.tlpNumerics.Name = "tlpNumerics";
this.tlpNumerics.RowCount = 4;
this.tlpNumerics.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tlpNumerics.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tlpNumerics.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tlpNumerics.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tlpNumerics.Size = new System.Drawing.Size(105, 140);
this.tlpNumerics.TabIndex = 2;
//
// button11
//
this.button11.BackColor = System.Drawing.Color.MediumPurple;
this.button11.Dock = System.Windows.Forms.DockStyle.Fill;
this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button11.ForeColor = System.Drawing.Color.White;
this.button11.Location = new System.Drawing.Point(3, 108);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(29, 29);
this.button11.TabIndex = 11;
this.button11.Text = "0";
this.button11.UseCompatibleTextRendering = true;
this.button11.UseVisualStyleBackColor = false;
this.button11.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.MediumPurple;
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(38, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(29, 29);
this.button1.TabIndex = 1;
this.button1.Text = "8";
this.button1.UseCompatibleTextRendering = true;
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.MediumPurple;
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.ForeColor = System.Drawing.Color.White;
this.button2.Location = new System.Drawing.Point(3, 3);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(29, 29);
this.button2.TabIndex = 2;
this.button2.Text = "7";
this.button2.UseCompatibleTextRendering = true;
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button3
//
this.button3.BackColor = System.Drawing.Color.MediumPurple;
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.ForeColor = System.Drawing.Color.White;
this.button3.Location = new System.Drawing.Point(73, 3);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(29, 29);
this.button3.TabIndex = 3;
this.button3.Text = "9";
this.button3.UseCompatibleTextRendering = true;
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button4
//
this.button4.BackColor = System.Drawing.Color.MediumPurple;
this.button4.Dock = System.Windows.Forms.DockStyle.Fill;
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button4.ForeColor = System.Drawing.Color.White;
this.button4.Location = new System.Drawing.Point(3, 38);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(29, 29);
this.button4.TabIndex = 4;
this.button4.Text = "4";
this.button4.UseCompatibleTextRendering = true;
this.button4.UseVisualStyleBackColor = false;
this.button4.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button12
//
this.button12.BackColor = System.Drawing.Color.MediumPurple;
this.button12.Dock = System.Windows.Forms.DockStyle.Fill;
this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button12.ForeColor = System.Drawing.Color.White;
this.button12.Location = new System.Drawing.Point(73, 108);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(29, 29);
this.button12.TabIndex = 12;
this.button12.Text = ",";
this.button12.UseCompatibleTextRendering = true;
this.button12.UseVisualStyleBackColor = false;
this.button12.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button5
//
this.button5.BackColor = System.Drawing.Color.MediumPurple;
this.button5.Dock = System.Windows.Forms.DockStyle.Fill;
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.ForeColor = System.Drawing.Color.White;
this.button5.Location = new System.Drawing.Point(38, 38);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(29, 29);
this.button5.TabIndex = 5;
this.button5.Text = "5";
this.button5.UseCompatibleTextRendering = true;
this.button5.UseVisualStyleBackColor = false;
this.button5.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button7
//
this.button7.BackColor = System.Drawing.Color.MediumPurple;
this.button7.Dock = System.Windows.Forms.DockStyle.Fill;
this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button7.ForeColor = System.Drawing.Color.White;
this.button7.Location = new System.Drawing.Point(3, 73);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(29, 29);
this.button7.TabIndex = 7;
this.button7.Text = "1";
this.button7.UseCompatibleTextRendering = true;
this.button7.UseVisualStyleBackColor = false;
this.button7.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button8
//
this.button8.BackColor = System.Drawing.Color.MediumPurple;
this.button8.Dock = System.Windows.Forms.DockStyle.Fill;
this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button8.ForeColor = System.Drawing.Color.White;
this.button8.Location = new System.Drawing.Point(38, 73);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(29, 29);
this.button8.TabIndex = 8;
this.button8.Text = "2";
this.button8.UseCompatibleTextRendering = true;
this.button8.UseVisualStyleBackColor = false;
this.button8.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button9
//
this.button9.BackColor = System.Drawing.Color.MediumPurple;
this.button9.Dock = System.Windows.Forms.DockStyle.Fill;
this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button9.ForeColor = System.Drawing.Color.White;
this.button9.Location = new System.Drawing.Point(73, 73);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(29, 29);
this.button9.TabIndex = 9;
this.button9.Text = "3";
this.button9.UseCompatibleTextRendering = true;
this.button9.UseVisualStyleBackColor = false;
this.button9.Click += new System.EventHandler(this.btnNumeric_Click);
//
// button6
//
this.button6.BackColor = System.Drawing.Color.MediumPurple;
this.button6.Dock = System.Windows.Forms.DockStyle.Fill;
this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button6.ForeColor = System.Drawing.Color.White;
this.button6.Location = new System.Drawing.Point(73, 38);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(29, 29);
this.button6.TabIndex = 6;
this.button6.Text = "6";
this.button6.UseCompatibleTextRendering = true;
this.button6.UseVisualStyleBackColor = false;
this.button6.Click += new System.EventHandler(this.btnNumeric_Click);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.Controls.Add(this.btnResetA ctValue, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.btnDiv, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.btnMul, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.btnReset, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.btnAdd, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.btnSub, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.btnErg, 1, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(121, 57);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute, 35F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(105, 140);
this.tableLayoutPanel1.TabIndex = 3;
//
// btnResetActValue
//
this.btnResetActValue.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.btnResetActValue.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnResetActValue.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnResetActValue.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnResetActValue.ForeColor = System.Drawing.Color.Transparent;
this.btnResetActValue.Location = new System.Drawing.Point(3, 108);
this.btnResetActValue.Name = "btnResetActValue";
this.btnResetActValue.Size = new System.Drawing.Size(29, 29);
this.btnResetActValue.TabIndex = 12;
this.btnResetActValue.Text = "CE";
this.btnResetActValue.UseCompatibleTextRendering = true;
this.btnResetActValue.UseVisualStyleBackColor = false;
this.btnResetActValue.Click += new System.EventHandler(this.btnResetActValue_Click);
//
// btnDiv
//
this.btnDiv.BackColor = System.Drawing.Color.RoyalBlue;
this.btnDiv.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnDiv.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDiv.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.btnDiv.ForeColor = System.Drawing.Color.White;
this.btnDiv.Location = new System.Drawing.Point(3, 3);
this.btnDiv.Name = "btnDiv";
this.btnDiv.Size = new System.Drawing.Size(29, 29);
this.btnDiv.TabIndex = 3;
this.btnDiv.Text = "/";
this.btnDiv.UseCompatibleTextRendering = true;
this.btnDiv.UseVisualStyleBackColor = false;
this.btnDiv.Click += new System.EventHandler(this.btnOp_Click);
//
// btnMul
//
this.btnMul.BackColor = System.Drawing.Color.RoyalBlue;
this.btnMul.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnMul.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMul.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.btnMul.ForeColor = System.Drawing.Color.White;
this.btnMul.Location = new System.Drawing.Point(38, 3);
this.btnMul.Name = "btnMul";
this.btnMul.Size = new System.Drawing.Size(29, 29);
this.btnMul.TabIndex = 2;
this.btnMul.Text = "*";
this.btnMul.UseCompatibleTextRendering = true;
this.btnMul.UseVisualStyleBackColor = false;
this.btnMul.Click += new System.EventHandler(this.btnOp_Click);
//
// btnReset
//
this.btnReset.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.btnReset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnReset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReset.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnReset.ForeColor = System.Drawing.Color.Transparent;
this.btnReset.Location = new System.Drawing.Point(73, 108);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(29, 29);
this.btnReset.TabIndex = 6;
this.btnReset.Text = "C";
this.btnReset.UseVisualStyleBackColor = false;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// btnAdd
//
this.btnAdd.BackColor = System.Drawing.Color.RoyalBlue;
this.btnAdd.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.btnAdd.ForeColor = System.Drawing.Color.White;
this.btnAdd.Location = new System.Drawing.Point(73, 3);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(29, 29);
this.btnAdd.TabIndex = 0;
this.btnAdd.Text = "+";
this.btnAdd.UseCompatibleTextRendering = true;
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnOp_Click);
//
// btnSub
//
this.btnSub.BackColor = System.Drawing.Color.RoyalBlue;
this.btnSub.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnSub.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSub.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.btnSub.ForeColor = System.Drawing.Color.White;
this.btnSub.Location = new System.Drawing.Point(73, 38);
this.btnSub.Name = "btnSub";
this.btnSub.Size = new System.Drawing.Size(29, 29);
this.btnSub.TabIndex = 1;
this.btnSub.Text = "-";
this.btnSub.UseCompatibleTextRendering = true;
this.btnSub.UseVisualStyleBackColor = false;
this.btnSub.Click += new System.EventHandler(this.btnOp_Click);
//
// btnErg
//
this.btnErg.BackColor = System.Drawing.Color.RoyalBlue;
this.btnErg.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnErg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnErg.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.btnErg.ForeColor = System.Drawing.Color.White;
this.btnErg.Location = new System.Drawing.Point(38, 108);
this.btnErg.Name = "btnErg";
this.btnErg.Size = new System.Drawing.Size(29, 29);
this.btnErg.TabIndex = 4;
this.btnErg.Text = "=";
this.btnErg.UseCompatibleTextRendering = true;
this.btnErg.UseVisualStyleBackColor = false;
this.btnErg.Click += new System.EventHandler(this.btnErg_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.Crimson;
this.label1.Location = new System.Drawing.Point(5, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 16);
this.label1.TabIndex = 7;
this.label1.Text = "Rechnung";
//
// tbxCalculation
//
this.tbxCalculation.BackColor = System.Drawing.Color.LightSeaGreen;
this.tbxCalculation.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tbxCalculation.Dock = System.Windows.Forms.DockStyle.Top;
this.tbxCalculation.Location = new System.Drawing.Point(0, 0);
this.tbxCalculation.Name = "tbxCalculation";
this.tbxCalculation.ReadOnly = true;
this.tbxCalculation.Size = new System.Drawing.Size(261, 13);
this.tbxCalculation.TabIndex = 9;
this.tbxCalculation.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.tbxActValue);
this.panel1.Controls.Add(this.tbxCalculation);
this.panel1.Location = new System.Drawing.Point(5, 23);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(263, 31);
this.panel1.TabIndex = 11;
//
// tbxActValue
//
this.tbxActValue.BackColor = System.Drawing.Color.LightSeaGreen;
this.tbxActValue.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tbxActValue.Dock = System.Windows.Forms.DockStyle.Top;
this.tbxActValue.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxActValue.Location = new System.Drawing.Point(0, 13);
this.tbxActValue.Name = "tbxActValue";
this.tbxActValue.ReadOnly = true;
this.tbxActValue.Size = new System.Drawing.Size(261, 17);
this.tbxActValue.TabIndex = 13;
this.tbxActValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// CalculatorGUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::TR.Properties.Resources.tr_bg;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(278, 222);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label1);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.tlpNumerics);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this. Icon")));
this.Name = "CalculatorGUI";
this.Text = "Rechner";
this.tlpNumerics.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tlpNumerics;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
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 btnErg;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbxCalculation;
private System.Windows.Forms.Button button11;
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 button12;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox tbxActValue;
private System.Windows.Forms.Button btnResetActValue;
}
}
[/highlight]
Und hier nochma die ganze Projektmappe zum downloaden:
TR.rar
Gehe zu:
Showroom
Nach oben
- Bereiche
- Benutzerkontrollzentrum
- Private Nachrichten
- Abonnements
- Wer ist online
- Foren durchsuchen
- Forum-Startseite
- Foren
- U-Labs Intern
- Talk, Talk, Talk!
- News-Bereich
- Multimedia
- Technikecke
- Programmierung
- Gaming Area
- Knuddels und die Szene
Ähnliche Themen
-
Anfänger Einfacher Taschenrechner
Von DMW007 im Forum AufgabenAntworten: 3Letzter Beitrag: 12.08.2013, 15:55 -
[C++] Einfacher Taschenrechner
Von DMW007 im Forum C++Antworten: 2Letzter Beitrag: 11.01.2012, 01:56 -
[C#] Taschenrechner-Konsole
Von Snees im Forum .NetAntworten: 2Letzter Beitrag: 17.12.2011, 12:58
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.
Alle Zeitangaben in WEZ +2. Es ist jetzt 14:41 Uhr.
Powered by vBulletin® - © Jelsoft Enterprises Ltd.