2017年10月10日 星期二

第 3 章 小小電子琴

第 3 章 小小電子琴

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button1.Click
        Console.Beep(262, 500)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button2.Click
        Console.Beep(294, 500)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button3.Click
        Console.Beep(330, 500)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button4.Click
        Console.Beep(349, 500)
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button5.Click
        Console.Beep(392, 500)
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button6.Click
        Console.Beep(440, 500)
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button7.Click
        Console.Beep(493, 500)
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button8.Click
        Console.Beep(523, 500)
    End Sub

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
    Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.D1 : Console.Beep(262, 500)
            Case Keys.D2 : Console.Beep(294, 500)
            Case Keys.D3 : Console.Beep(330, 500)
            Case Keys.D4 : Console.Beep(349, 500)
            Case Keys.D5 : Console.Beep(392, 500)
            Case Keys.D6 : Console.Beep(440, 500)
            Case Keys.D7 : Console.Beep(493, 500)
            Case Keys.D8 : Console.Beep(523, 500)
            Case Else : Exit Sub
        End Select
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Timer1.Tick
        Label1.Text = Now.ToString
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles MyBase.Load
        Label1.Text = Now.ToString
        Label2.Text = WeekdayName(Weekday(Now))
        Label1.Left = (Me.ClientSize.Width - Label1.Width) / 2
        Timer1.Start()
    End Sub
End Class

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...