• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamepythonphpguiwindowsc翻訳omegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

練習用です。いろんなものがごちゃまぜです。


コミットメタ情報

リビジョン393 (tree)
日時2018-05-10 16:48:20
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- Calc/Calc/Form1.Designer.vb (revision 392)
+++ Calc/Calc/Form1.Designer.vb (revision 393)
@@ -40,6 +40,7 @@
4040 Me.TextBox1 = New System.Windows.Forms.TextBox()
4141 Me.ListBox1 = New System.Windows.Forms.ListBox()
4242 Me.Label1 = New System.Windows.Forms.Label()
43+ Me.btnClear = New System.Windows.Forms.Button()
4344 Me.SuspendLayout()
4445 '
4546 'Button1
@@ -202,11 +203,21 @@
202203 Me.Label1.TabIndex = 3
203204 Me.Label1.Text = "Label1"
204205 '
206+ 'btnClear
207+ '
208+ Me.btnClear.Location = New System.Drawing.Point(421, 208)
209+ Me.btnClear.Name = "btnClear"
210+ Me.btnClear.Size = New System.Drawing.Size(75, 27)
211+ Me.btnClear.TabIndex = 4
212+ Me.btnClear.Text = "C"
213+ Me.btnClear.UseVisualStyleBackColor = True
214+ '
205215 'Form1
206216 '
207217 Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
208218 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
209219 Me.ClientSize = New System.Drawing.Size(800, 450)
220+ Me.Controls.Add(Me.btnClear)
210221 Me.Controls.Add(Me.Label1)
211222 Me.Controls.Add(Me.ListBox1)
212223 Me.Controls.Add(Me.TextBox1)
@@ -250,4 +261,5 @@
250261 Friend WithEvents TextBox1 As TextBox
251262 Friend WithEvents ListBox1 As ListBox
252263 Friend WithEvents Label1 As Label
264+ Friend WithEvents btnClear As Button
253265 End Class
--- Calc/Calc/Form1.vb (revision 392)
+++ Calc/Calc/Form1.vb (revision 393)
@@ -1,18 +1,24 @@
11 Public Class Form1
22
3- Private r As New calcModel
4- Private s As String = String.Empty
3+ Private model As New calcModel
54
6- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click, ButtonPlus.Click, Button9.Click, Button8.Click, Button7.Click, Button6.Click, Button5.Click, Button4.Click, Button3.Click, Button2.Click, Button14.Click, Button13.Click, Button12.Click, Button11.Click, Button0.Click
5+
6+ Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button1.Click, ButtonPlus.Click, Button9.Click, Button8.Click, Button7.Click, Button6.Click, Button5.Click, Button4.Click, Button3.Click, Button2.Click, Button14.Click, Button13.Click, Button12.Click, Button11.Click, Button0.Click
77 Dim t = DirectCast(sender, Button).Text(0)
8- r.add(t)
9- TextBox1.Text = r.value()
10- Label1.Text = r.expression
11- ListBox1.DataSource = Nothing
12- ListBox1.DataSource = r.history
8+ model.add(t)
9+ ViewUpdate()
1310 End Sub
1411
15- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
12+ Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
13+ model.expression = String.Empty
14+ ViewUpdate()
15+ End Sub
1616
17+ Private Sub ViewUpdate()
18+ TextBox1.Text = model.value()
19+ Label1.Text = model.expression
20+ ListBox1.DataSource = Nothing
21+ ListBox1.DataSource = model.history
1722 End Sub
23+
1824 End Class
--- Calc/Calc/evaluator.vb (revision 392)
+++ Calc/Calc/evaluator.vb (revision 393)
@@ -49,8 +49,10 @@
4949 Case "-"
5050 ans -= num
5151 Case "/"
52+ 'todo:1/0
5253 ans /= num
5354 Case "*"
55+ 'todo:大きすぎる値
5456 ans *= num
5557 End Select
5658 End Sub