Листинг 2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace SimpleCalc { public partial class FormCalculate : Form { private Calculate cl; string strNum = ""; public FormCalculate() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { cl = new Calculate(this); } private void btNum1_Click(object sender, EventArgs e) { enterNum(btNum1.Text); } private void btNum2_Click(object sender, EventArgs e) { enterNum(btNum2.Text); } private void btNum3_Click(object sender, EventArgs e) { enterNum(btNum3.Text); } private void btNum4_Click(object sender, EventArgs e) { enterNum(btNum4.Text); } private void btNum5_Click(object sender, EventArgs e) { enterNum(btNum5.Text); } private void btNum6_Click(object sender, EventArgs e) { enterNum(btNum6.Text); } private void btNum7_Click(object sender, EventArgs e) { enterNum(btNum7.Text); } private void btNum8_Click(object sender, EventArgs e) { enterNum(btNum8.Text); } private void btNum9_Click(object sender, EventArgs e) { enterNum(btNum9.Text); } private void btMinus_Click(object sender, EventArgs e) { enterAction(btMinus.Text); } private void btNum0_Click(object sender, EventArgs e) { enterNum(btNum0.Text); } private void btPlus_Click(object sender, EventArgs e) { enterAction(btPlus.Text); } private void btCount_Click(object sender, EventArgs e) { cl.ChoiceMethod(strNum); string answ=cl.Count(); this.txtWatch.Text += " = " + answ; strNum = answ; listLog.Items.Add(cl.LineLog); } private void btShare_Click(object sender, EventArgs e) { enterAction(btShare.Text); } private void btMultiply_Click(object sender, EventArgs e) { enterAction(btMultiply.Text); } private void enterNum(string num) { this.txtWatch.Text += num; strNum += num; } private void enterAction(string tag) { cl.ChoiceMethod(strNum); cl.ChoiceMethod(tag); strNum = ""; txtWatch.Text += strNum + " " + tag + " "; } private void txtWatch_TextChanged(object sender, EventArgs e) { if (txtWatch.Text == "") { strNum = ""; } } private void btClear_Click(object sender, EventArgs e) { txtWatch.Clear(); } } }
|