2019年5月27日 星期一

原子序--程式碼示範



Public Class Form1
    Dim atomic As Integer
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        atomic = Val(TextBox1.Text)
        Select Case atomic
            Case 1
                Label1.Text = "H"
                label2.text = "氫"
            Case 2
                Label1.Text = "He"
                Label2.Text = "氦"
            Case 3
                Label1.Text = "LI"
                Label2.Text = "鋰"
            Case 4
                Label1.Text = "Be"
                Label2.Text = "鈹"
            Case 5
                Label1.Text = "B"
                Label2.Text = "硼"
        End Select
    End Sub

    Private Sub Button1_MouseMove(sender As Object, e As MouseEventArgs) Handles Button1.MouseMove
        TextBox1.Text = "1"
        Label1.Text = "H"
        Label2.Text = "氫"
    End Sub

    Private Sub Button5_MouseMove(sender As Object, e As MouseEventArgs) Handles Button5.MouseMove
        TextBox1.Text = "2"
        Label1.Text = "He"
        Label2.Text = "氦"
    End Sub

    Private Sub Button2_MouseMove(sender As Object, e As MouseEventArgs) Handles Button2.MouseMove
        TextBox1.Text = "3"
        Label1.Text = "Li"
        Label2.Text = "鋰"
    End Sub



    Private Sub Button3_MouseMove(sender As Object, e As MouseEventArgs) Handles Button3.MouseMove
        TextBox1.Text = "4"
        Label1.Text = "Be"
        Label2.Text = "鈹"
    End Sub



    Private Sub Button4_MouseMove(sender As Object, e As MouseEventArgs) Handles Button4.MouseMove
        TextBox1.Text = "5"
        Label1.Text = "B"
        Label2.Text = "硼"
    End Sub
End Class

沒有留言:

張貼留言