📄 form1.frm
字号:
VERSION 5.00
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "为动画添加背景音乐"
ClientHeight = 6180
ClientLeft = 165
ClientTop = 870
ClientWidth = 8325
LinkTopic = "Form1"
ScaleHeight = 6180
ScaleWidth = 8325
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 120
Top = 4680
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MCI.MMControl MMControl1
Height = 375
Left = 840
TabIndex = 4
Top = 4920
Width = 5295
_ExtentX = 9340
_ExtentY = 661
_Version = 393216
UpdateInterval = 80
DeviceType = ""
FileName = ""
End
Begin VB.CommandButton command1
Caption = "隐藏MCI控件"
Height = 735
Left = 6600
TabIndex = 2
Top = 4320
Width = 1335
End
Begin VB.HScrollBar HScroll1
Height = 375
Left = 840
TabIndex = 1
Top = 4320
Width = 5295
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 80
Left = 360
Top = 3840
End
Begin VB.PictureBox Picture1
Height = 3255
Left = 720
ScaleHeight = 213
ScaleMode = 3 'Pixel
ScaleWidth = 445
TabIndex = 0
Top = 360
Width = 6735
Begin VB.Shape Shape2
FillColor = &H000000FF&
FillStyle = 0 'Solid
Height = 855
Left = 3120
Shape = 3 'Circle
Top = 1200
Width = 1335
End
Begin VB.Shape Shape1
FillColor = &H00FF0000&
FillStyle = 0 'Solid
Height = 735
Left = 480
Shape = 3 'Circle
Top = 1200
Width = 495
End
End
Begin VB.Label label1
Height = 495
Left = 840
TabIndex = 3
Top = 5640
Width = 5295
End
Begin VB.Menu kz
Caption = "控制"
Begin VB.Menu begin
Caption = "动画开始"
End
End
Begin VB.Menu xuan
Caption = "播放音乐"
End
Begin VB.Menu over
Caption = "退出"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x%, y%, a%, b%, t!, r%
Private Sub begin_Click()
If begin.Caption = "动画开始" And Timer1.Enabled = False Then
Timer1.Enabled = True
begin.Caption = "动画停止"
Else
begin.Caption = "动画开始"
Timer1.Enabled = False
End If
End Sub
Private Sub command1_Click()
If MMControl1.Visible = True And HScroll1.Visible = True And command1.Caption = "隐藏MCI控件" Then
MMControl1.Visible = False
HScroll1.Visible = False
command1.Caption = "显示MCI控件"
Else: MMControl1.Visible = True
HScroll1.Visible = True
command1.Caption = "隐藏MCI控件"
End If
End Sub
Private Sub over_Click()
End
End Sub
Private Sub MMControl1_StatusUpdate()
HScroll1.Max = MMControl1.Length / 100
HScroll1.Value = MMControl1.Position / 100
If MMControl1.Position = MMControl1.Length Then
MMControl1.Command = "close"
MMControl1.Command = "open"
MMControl1.Command = "play"
End If
End Sub
Private Sub Timer1_Timer()
x = Picture1.ScaleWidth / 2
y = Picture1.ScaleHeight / 2
If x > y Then
r = y / 3
Else
r = x / 3
End If
b = r * 2.5
r = r * 5
a = r
FillStyle = 1
Picture1.Circle (x, y), r, RGB(0, 0, 0), , , 0.5
Shape1.Move x + a * Cos(t) - Shape1.Width / 2, y + b * Sin(t) - Shape1.Height / 2
t = t + 0.1
End Sub
Private Sub xuan_Click()
CommonDialog1.InitDir = "F:\"
CommonDialog1.Filter = CommonDialog1.Filter + "Mp3|*.mp3"
CommonDialog1.Action = 1
MMControl1.FileName = CommonDialog1.FileName
MMControl1.Command = "open"
MMControl1.Command = "play"
label1.Caption = "播放文件:" + CommonDialog1.FileName
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -