注册 登录
编程论坛 VB.NET论坛

新手小学生求教!

时沙丶 发布于 2016-10-12 22:17, 3385 次点击
做一个最基本标签代码,要求如下:
实现标签沿窗体内侧按顺时针方向自动运行;
做一个动态变换按钮:
(1)按钮位置随机变换; (2)按钮大小随机变换; (3)按钮背景颜色随机变换
做一个计算器:
    实现智能计算器的设计,主要实现小学数学智能运算。
跪求各位大神!在此先行谢过!蓝瘦!香菇!!!
6 回复
#2
益达炒鸡蛋2016-10-30 16:06
提示: 作者被禁止或删除 内容自动屏蔽,只有管理员可见
#3
祝凯迪2016-10-31 03:55
现在小学都学了吗
#4
FizzyElf2016-11-01 20:16
Public Class Form1
    Dim strmiddle() As String = {"0", "0", "0"}
    Dim calmethod1 As String = "0"
    Dim calmethod2 As String = "0"
    Dim strdot As Boolean = False

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        If strmiddle(0) = "0" Then
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "0"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "0"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
        strdot = True
        strmiddle(0) = strmiddle(0) & "."
        TextBox1.Text = strmiddle(0)
    End Sub

    Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
        strmiddle(0) = "0"
        strmiddle(1) = "0"
        strmiddle(2) = "0"
        calmethod1 = "0"
        calmethod2 = "0"
        strdot = False
        TextBox1.Text = "0."
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "1"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "1"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "1"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "2"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "2"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "2"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "3"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "3"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "3"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "4"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "4"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "4"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "5"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "5"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "5"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "6"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "6"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "6"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "7"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "7"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "7"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "8"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "8"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "8"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
        If strmiddle(0) = "0" Then
            strmiddle(0) = "9"
            TextBox1.Text = strmiddle(0) & "."
        ElseIf strdot = False Then
            strmiddle(0) = strmiddle(0) & "9"
            TextBox1.Text = strmiddle(0) & "."
        Else
            strmiddle(0) = strmiddle(0) & "9"
            TextBox1.Text = strmiddle(0)
        End If
    End Sub

    Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
        TextBox1.Text = "0"
    End Sub

    Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
        Me.Close()
    End Sub

    Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
        If calmethod1 = "0" Then
            calmethod1 = "*"
            strmiddle(1) = strmiddle(0)
            strmiddle(0) = "0"
        Else : Select Case calmethod1
                Case "+"
                    calmethod2 = "*"
                    strmiddle(2) = strmiddle(0)
                    strmiddle(0) = "0"
                Case "-"
                    calmethod2 = "*"
                    strmiddle(2) = strmiddle(0)
                    strmiddle(0) = "0"
                Case "*"
                    strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
                    strmiddle(0) = "0"
                    calmethod1 = "*"
                Case "/"
                    strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
                    strmiddle(0) = "0"
                    calmethod1 = "*"
            End Select
        End If
    End Sub

    Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
        If calmethod1 = "0" Then
            calmethod1 = "/"
            strmiddle(1) = strmiddle(0)
            strmiddle(0) = "0"
        Else : Select Case calmethod1
                Case "+"
                    calmethod2 = "/"
                    strmiddle(2) = strmiddle(0)
                    strmiddle(0) = "0"
                Case "-"
                    calmethod2 = "/"
                    strmiddle(2) = strmiddle(0)
                    strmiddle(0) = "0"
                Case "*"
                    strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
                    strmiddle(0) = "0"
                    calmethod1 = "/"
                Case "/"
                    strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
                    strmiddle(0) = "0"
                    calmethod1 = "/"
            End Select
        End If
    End Sub

    Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
        If calmethod1 = "0" Then
            calmethod1 = "+"
            strmiddle(1) = strmiddle(0)
            strmiddle(0) = "0"
        Else : Select Case calmethod1
                Case "+"
                    strmiddle(1) = Str(Val(strmiddle(0)) + Val(strmiddle(1)))
                    strmiddle(0) = "0"
                    calmethod1 = "+"
                Case "-"
                    strmiddle(1) = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
                    strmiddle(0) = "0"
                    calmethod1 = "+"
                Case "*"
                    strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
                    strmiddle(0) = "0"
                    calmethod1 = "+"
                Case "/"
                    strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
                    strmiddle(0) = "0"
                    calmethod1 = "+"
            End Select
        End If
    End Sub

    Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
        If calmethod1 = "0" Then
            calmethod1 = "-"
            strmiddle(1) = strmiddle(0)
            strmiddle(0) = "0"
        Else : Select Case calmethod1
                Case "+"
                    strmiddle(1) = Str(Val(strmiddle(0)) + Val(strmiddle(1)))
                    strmiddle(0) = "0"
                    calmethod1 = "-"
                Case "-"
                    strmiddle(1) = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
                    strmiddle(0) = "0"
                    calmethod1 = "-"
                Case "*"
                    strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
                    strmiddle(0) = "0"
                    calmethod1 = "-"
                Case "/"
                    strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
                    strmiddle(0) = "0"
                    calmethod1 = "-"
            End Select
        End If
    End Sub

    Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
        If strmiddle(2) = "0" Then
            Select Case calmethod1
                Case "+"
                    TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
                Case "-"
                    TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
                Case "*"
                    TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
                Case "/"
                    If strmiddle(0) = "0" Then
                        TextBox1.Text = "error!"
                    Else
                        TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
                    End If
            End Select
        ElseIf calmethod2 = "*" Then
            strmiddle(0) = Str(Val(strmiddle(0)) + Val(strmiddle(2)))
            Select Case calmethod1
                Case "+"
                    TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
                Case "-"
                    TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
                Case "*"
                    TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
                Case "/"
                    If strmiddle(0) = "0" Then
                        TextBox1.Text = "error!"
                    Else
                        TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
                    End If
            End Select
        Else : calmethod2 = "/"
            strmiddle(0) = Str(Val(strmiddle(2)) + Val(strmiddle(0)))
            Select Case calmethod1
                Case "+"
                    TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
                Case "-"
                    TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
                Case "*"
                    TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
                Case "/"
                    If strmiddle(0) = "0" Then
                        TextBox1.Text = "error!"
                    Else
                        TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
                    End If
            End Select
        End If
    End Sub
End Class
#5
FizzyElf2016-11-01 20:17
回复 4楼 FizzyElf
计算器
#6
时沙丶2016-11-04 17:17
回复 3楼 祝凯迪
计算机火了
#7
时沙丶2016-11-04 17:18
回复 4楼 FizzyElf
厉害我Word哥
1