⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dzqdiy.frm

📁 解压后为多媒体电子琴源代码,希望大家喜欢!
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   56
         Left            =   2796
         Style           =   1  'Graphical
         TabIndex        =   25
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   54
         Left            =   2556
         Style           =   1  'Graphical
         TabIndex        =   24
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   51
         Left            =   2076
         Style           =   1  'Graphical
         TabIndex        =   23
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   49
         Left            =   1836
         Style           =   1  'Graphical
         TabIndex        =   22
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   59
         Left            =   3132
         Style           =   1  'Graphical
         TabIndex        =   21
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   57
         Left            =   2892
         Style           =   1  'Graphical
         TabIndex        =   20
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   55
         Left            =   2652
         Style           =   1  'Graphical
         TabIndex        =   19
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   53
         Left            =   2412
         Style           =   1  'Graphical
         TabIndex        =   18
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   52
         Left            =   2172
         Style           =   1  'Graphical
         TabIndex        =   17
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   50
         Left            =   1932
         Style           =   1  'Graphical
         TabIndex        =   16
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   48
         Left            =   1692
         Style           =   1  'Graphical
         TabIndex        =   15
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   46
         Left            =   1356
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   44
         Left            =   1116
         Style           =   1  'Graphical
         TabIndex        =   13
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   42
         Left            =   876
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   39
         Left            =   396
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00404040&
         Height          =   696
         Index           =   37
         Left            =   156
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   0
         Width           =   180
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   47
         Left            =   1452
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   45
         Left            =   1212
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   43
         Left            =   972
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   41
         Left            =   732
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   40
         Left            =   492
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   38
         Left            =   252
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   0
         Width           =   252
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FFFFFF&
         Height          =   1104
         Index           =   36
         Left            =   12
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   0
         Width           =   252
      End
   End
   Begin VB.CommandButton Command2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   5.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   180
      Left            =   7092
      TabIndex        =   1
      Top             =   180
      Width           =   228
   End
   Begin VB.OptionButton Option1 
      Caption         =   "钢琴F1"
      Height          =   396
      Index           =   0
      Left            =   108
      TabIndex        =   0
      Top             =   108
      Width           =   972
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MidiOut, YS, YF As Long
Dim n(125) As Integer
Dim xz, p(2) As Integer

Function Play(ByVal p As Integer, ByVal k As Integer)
    YS = &H100 * p + &HC0
    midiOutShortMsg MidiOut, YS
    YF = &H10000 * 127 + &H100 * k + &H90
    midiOutShortMsg MidiOut, YF
End Function

Private Sub Form_Load()
    Dim i, j As Integer
    Dim s As String
    s = "zZxXcvVbBnNmaAsSdfFgGhHj"
    s = s + "qQwWerRtTyYu1!2@34$5%6^78*9(0"
    For j = 36 To 88
        i = Asc(Mid(s, j - 35, 1))
        n(i) = j
    Next j
    '以上设置字符与琴键对应,其中大写字母对黑键
    n(44) = 48: n(46) = 50: n(47) = 52
    n(107) = 60: n(108) = 62
    n(59) = 64: n(39) = 65
    n(105) = 72: n(111) = 74: n(112) = 76
    n(91) = 77: n(93) = 79
    p(0) = 0: p(1) = 71: p(2) = 91
    MidiOut = 0
    midiOutOpen MidiOut, -1, 0, 0, 0
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    Dim a As Integer
    a = KeyAscii
    midiOutShortMsg MidiOut, &H7BB0
    If n(a) > 35 And n(a) < 89 Then
        Command1(n(a)).SetFocus
        Play p(xz), n(a)
    Else
        Option1(xz).SetFocus
    End If
End Sub

Private Sub Command1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Play p(xz), Command1(Index).Index
End Sub

Private Sub Command2_Click()
    midiOutClose MidiOut
    End
End Sub

Private Sub Form_Unload(Cancel As Integer)
    midiOutClose MidiOut
    End
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    midiOutShortMsg MidiOut, &H7BB0
    Option1(xz).SetFocus
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode > 111 And KeyCode < 115 Then
        xz = KeyCode - 112
        Option1(xz).SetFocus
    End If
End Sub

Private Sub Option1_Click(Index As Integer)
    xz = Option1(Index).Index
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -