Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents Button10 As System.Windows.Forms.Button
Friend WithEvents Button11 As System.Windows.Forms.Button
Friend WithEvents Button12 As System.Windows.Forms.Button
Friend WithEvents Button13 As System.Windows.Forms.Button
Friend WithEvents Button14 As System.Windows.Forms.Button
Friend WithEvents Button15 As System.Windows.Forms.Button
Friend WithEvents Button16 As System.Windows.Forms.Button
Friend WithEvents Button17 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.Button9 = New System.Windows.Forms.Button
Me.Button10 = New System.Windows.Forms.Button
Me.Button11 = New System.Windows.Forms.Button
Me.Button12 = New System.Windows.Forms.Button
Me.Button13 = New System.Windows.Forms.Button
Me.Button14 = New System.Windows.Forms.Button
Me.Button15 = New System.Windows.Forms.Button
Me.Button16 = New System.Windows.Forms.Button
Me.Button17 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(8, 40)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(280, 21)
Me.TextBox1.TabIndex = 15
Me.TextBox1.Text = ""
'
'LinkLabel1
'
Me.LinkLabel1.Font = New System.Drawing.Font("宋体", 25.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.LinkLabel1.ForeColor = System.Drawing.SystemColors.Desktop
Me.LinkLabel1.Location = New System.Drawing.Point(48, 0)
Me.LinkLabel1.Name = "LinkLabel1"
Me.LinkLabel1.Size = New System.Drawing.Size(224, 32)
Me.LinkLabel1.TabIndex = 16
Me.LinkLabel1.TabStop = True
Me.LinkLabel1.Text = "小型计算器"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(16, 80)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(32, 24)
Me.Button1.TabIndex = 17
Me.Button1.Text = "1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(64, 80)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(32, 24)
Me.Button2.TabIndex = 18
Me.Button2.Text = "2"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(112, 80)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(32, 24)
Me.Button3.TabIndex = 19
Me.Button3.Text = "3"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(16, 120)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(32, 24)
Me.Button4.TabIndex = 20
Me.Button4.Text = "4"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(64, 120)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(32, 24)
Me.Button5.TabIndex = 21
Me.Button5.Text = "5"
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(112, 120)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(32, 24)
Me.Button6.TabIndex = 22
Me.Button6.Text = "6"
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(16, 160)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(32, 24)
Me.Button7.TabIndex = 23
Me.Button7.Text = "7"
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(64, 160)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(32, 24)
Me.Button8.TabIndex = 24
Me.Button8.Text = "8"
'
'Button9
'
Me.Button9.Location = New System.Drawing.Point(112, 160)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(32, 24)
Me.Button9.TabIndex = 25
Me.Button9.Text = "9"
'
'Button10
'
Me.Button10.Location = New System.Drawing.Point(16, 200)
Me.Button10.Name = "Button10"
Me.Button10.Size = New System.Drawing.Size(32, 24)
Me.Button10.TabIndex = 26
Me.Button10.Text = "."
'
'Button11
'
Me.Button11.Location = New System.Drawing.Point(112, 200)
Me.Button11.Name = "Button11"
Me.Button11.Size = New System.Drawing.Size(32, 24)
Me.Button11.TabIndex = 27
Me.Button11.Text = "0"
'
'Button12
'
Me.Button12.Location = New System.Drawing.Point(176, 80)
Me.Button12.Name = "Button12"
Me.Button12.Size = New System.Drawing.Size(32, 24)
Me.Button12.TabIndex = 28
Me.Button12.Text = "+"
'
'Button13
'
Me.Button13.Location = New System.Drawing.Point(248, 80)
Me.Button13.Name = "Button13"
Me.Button13.Size = New System.Drawing.Size(32, 24)
Me.Button13.TabIndex = 29
Me.Button13.Text = "-"
'
'Button14
'
Me.Button14.Location = New System.Drawing.Point(216, 120)
Me.Button14.Name = "Button14"
Me.Button14.Size = New System.Drawing.Size(32, 24)
Me.Button14.TabIndex = 30
Me.Button14.Text = "="
'
'Button15
'
Me.Button15.Location = New System.Drawing.Point(176, 160)
Me.Button15.Name = "Button15"
Me.Button15.Size = New System.Drawing.Size(32, 24)
Me.Button15.TabIndex = 31
Me.Button15.Text = "*"
'
'Button16
'
Me.Button16.Location = New System.Drawing.Point(256, 152)
Me.Button16.Name = "Button16"
Me.Button16.Size = New System.Drawing.Size(32, 24)
Me.Button16.TabIndex = 32
Me.Button16.Text = "/"
'
'Button17
'
Me.Button17.Location = New System.Drawing.Point(216, 200)
Me.Button17.Name = "Button17"
Me.Button17.Size = New System.Drawing.Size(32, 24)
Me.Button17.TabIndex = 33
Me.Button17.Text = "CE"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button17)
Me.Controls.Add(Me.Button16)
Me.Controls.Add(Me.Button15)
Me.Controls.Add(Me.Button14)
Me.Controls.Add(Me.Button13)
Me.Controls.Add(Me.Button12)
Me.Controls.Add(Me.Button11)
Me.Controls.Add(Me.Button10)
Me.Controls.Add(Me.Button9)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.LinkLabel1)
Me.Controls.Add(Me.TextBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button1.Text
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button2.Text
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button3.Text
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0 " Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button4.Text
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button5.Text
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button6.Text
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button7.Text
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button8.Text
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If q = 5 Then TextBox1.Text = ""
If TextBox1.Text = "0" Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button9.Text
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If q = 5 Then TextBox1.Text = ""
TextBox1.Text = TextBox1.Text + Button11.Text
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If q = 6 Then
TextBox1.Text = TextBox1.Text
Else
TextBox1.Text = TextBox1.Text + Button10.Text
End If
q = 6
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
q = 1
a = TextBox1.Text
If q = 5 Then a = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
q = 2
a = TextBox1.Text
If q = 5 Then a = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub Button14_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
b = TextBox1.Text
If q = 1 Then d = a + b
If q = 2 Then d = a - b
If q = 3 Then d = a * b
If q = 4 Then d = a / b
TextBox1.Text = d
q = 5
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
q = 3
a = TextBox1.Text
If q = 5 Then a = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
q = 4
a = TextBox1.Text
If q = 5 Then a = TextBox1.Text
TextBox1.Text = ""
End Sub
Dim a As Double
Dim b As Double
Dim d As Double
Dim q As Integer
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
TextBox1.Text = ""
End Sub
Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
End Class