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

📄 midi.frm

📁 不错的一个VB菜单设计 界面和功能都不错
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   29
         Left            =   4170
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   38
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   31
         Left            =   4410
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   37
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   33
         Left            =   4650
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   36
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         ClipControls    =   0   'False
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   35
         Left            =   4890
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   35
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   36
         Left            =   5130
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   34
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   38
         Left            =   5370
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   33
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   40
         Left            =   5610
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   32
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   41
         Left            =   5850
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   31
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   43
         Left            =   6090
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   30
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   45
         Left            =   6330
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   29
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   47
         Left            =   6570
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   28
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   48
         Left            =   6810
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   27
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   50
         Left            =   7050
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   26
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   52
         Left            =   7290
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   25
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   53
         Left            =   7530
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   24
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   55
         Left            =   7770
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   23
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   57
         Left            =   8010
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   22
         Top             =   90
         Width           =   255
      End
      Begin VB.PictureBox Note 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DragMode        =   1  'Automatic
         ForeColor       =   &H00808080&
         Height          =   855
         Index           =   59
         Left            =   8250
         ScaleHeight     =   795
         ScaleWidth      =   195
         TabIndex        =   21
         Top             =   90
         Width           =   255
      End
   End
   Begin FLWMMedia.FWMIDI objMIDI 
      Left            =   1635
      Top             =   615
      _ExtentX        =   820
      _ExtentY        =   820
   End
   Begin FLWSystem.FWProfile objProfile 
      Left            =   0
      Top             =   600
      _ExtentX        =   820
      _ExtentY        =   820
   End
   Begin VB.Image imgDrag 
      Height          =   480
      Left            =   45
      Picture         =   "MIDI.frx":0442
      Top             =   45
      Visible         =   0   'False
      Width           =   480
   End
End
Attribute VB_Name = "frmMIDI"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim intKeyCount As Integer
Dim aKeys(512)  As Integer
Dim aColors()   As Long
Dim blnCreated  As Boolean

Private Sub Form_Load()
  Dim intInd As Integer
  
  If objMIDI.OpenPort Then
    hsMIDIChannel.Value = 0
    hsPatch.Value = 0
    hsVolume.Value = 100
    hsBalance.Value = 64
    hsOctave.Value = 2
    ReDim aColors(0 To Note.Count - 1) As Long
    For intInd = 0 To Note.Count - 1
      aColors(intInd) = Note(intInd).BackColor
    Next
    blnCreated = True
  Else
    Call MsgBox("No MIDI support dectected", vbCritical)
  End If
  
  ' refresh screen
  Call hsMIDIChannel_Change
  Call hsOctave_Change
  Call hsBalance_Change
  Call hsPatch_Change
  Call hsVolume_Change
End Sub

Private Sub Form_Unload(Cancel As Integer)
  If blnCreated Then
    Call objMIDI.ClosePort
  End If
End Sub

Private Sub hsMIDIChannel_Change()
  If blnCreated Then
    objMIDI.Channel = hsMIDIChannel.Value
    fraChannel = "Channel " & Str$(objMIDI.Channel + 1)
    hsPatch.Value = objMIDI.Patch
    hsVolume.Value = objMIDI.Volume
    hsBalance.Value = objMIDI.Balance
    hsOctave.Value = objMIDI.Octave / 12
  End If
End Sub

Private Sub hsOctave_Change()
  If blnCreated Then
    objMIDI.Octave = (hsOctave.Value * 12)
    fraOctave.Caption = "Octave " & hsOctave.Value
  End If
End Sub

Private Sub hsBalance_Change()
  If blnCreated Then
    objMIDI.Balance = hsBalance.Value
  End If
End Sub

Private Sub hsPatch_Change()
  Dim strPath As String
  
  If blnCreated Then
    objMIDI.Patch = hsPatch.Value
    strPath = App.Path
    If Right(strPath, 1) <> "\" Then
      strPath = strPath & "\"
    End If
    Call objProfile.Create(strPath & "PATCHES.INI")
    fraPatch.Caption = objProfile.ReadIni("MIDI Patches", Str$(objMIDI.Patch))
  End If
End Sub

Private Sub hsVolume_Change()
  If blnCreated Then
    objMIDI.Volume = hsVolume.Value
    fraVolume = "Volume " & objMIDI.Volume
  End If
End Sub

Private Sub Note_DragDrop(Index As Integer, Source As Control, x As Single, Y As Single)
  Dim intInd As Integer

  If blnCreated Then
    For intInd = 0 To intKeyCount - 1
      Call objMIDI.Note(aKeys(intInd), False)
      With Note(aKeys(intInd) - objMIDI.Octave)
        .BackColor = aColors(aKeys(intInd) - objMIDI.Octave)
        .DragIcon = LoadPicture()
      End With
    Next
    intKeyCount = 0
  End If
End Sub

Private Sub Note_DragOver(Index As Integer, Source As Control, x As Single, Y As Single, State As Integer)
  If blnCreated Then
    If intKeyCount > 0 Then
      If aKeys(intKeyCount - 1) = Index + objMIDI.Octave Then
        Exit Sub
      End If
    End If
    With Note(Index)
      .BackColor = vbRed
      .DragIcon = imgDrag.Picture
    End With
    Call objMIDI.Note(Index + objMIDI.Octave, True)
    aKeys(intKeyCount) = Index + objMIDI.Octave
    If intKeyCount < 511 Then
      intKeyCount = intKeyCount + 1
    End If
  End If
End Sub

⌨️ 快捷键说明

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