VB多媒体

Option Explicit
Dim cury, cury1, temp As Single, s1(1 To 3), s2(1 To 3) As String

Private Sub Form_Load()
Dim diskpathname As String, X, Y As Single
Move 0, 0, Screen.Width, Screen.Height  '根据屏幕分辨率调整窗口,screen.width屏幕宽度,如分辨率为1024*768,则screen.width值为1024
X = (ScaleWidth - Picture2.Width) / 2
Y = (ScaleHeight - Picture2.Height) / 2
Picture1.Move 0, 0
Picture2.Move Picture2.Left + X, Picture2.Top + Y
s1(3) = "程序功能:": s2(3) = "多媒体简历"
s1(2) = "设计单位:": s2(2) = "电子系"
s1(1) = "设计者:": s2(1) = "hdy"
cury = Picture1.CurrentY: cury1 = cury: temp = 8000 - Picture1.CurrentY
diskpathname = App.Path '返回EXE程序所在的文件夹的全路径
If Right(diskpathname, 1) = "\" Then
diskpathname = Left(diskpathname, Len(diskpathname) - 1) '判断应用程序所在路径是否为根目录,若为根目录则去掉路径中的"\"
End If
Picture1.Picture = LoadPicture(diskpathname + "\demo.bmp")
Form1.BackColor = QBColor(7) '参数0-15表示不同颜色 0黑 1蓝 2绿 3青 4红 6黄 7白 8灰
MCI1.FileName = diskpathname + "\demo.mp3"
MCI1.Command = "open" 'command属性open,play,stop,close,pause,back,step,next,save等
MCI1.Command = "play"
MCI2.DeviceType = "mp4" '打开avi类型视频文件,另外还有waveaudio、CDaudio和MPEGVideo
MCI2.FileName = diskpathname + "\demo.mp4"
MCI2.hWndDisplay = Picture2.hWnd 'hwndDisplay画面播放的位置,hwnd返回当前窗体的句柄
MCI2.Command = "open"
MCI2.Command = "play"
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
MCI1.Command = "stop"
MCI1.Command = "close"
MCI2.Command = "stop"
MCI2.Command = "close"
Unload Me '关闭当前窗体
End If
End Sub

Private Sub Timer1_Timer() '注:if是判断,并不是循环,此部分程序隔一个timer就执行一次
Dim i As Integer
cury = cury1
If MCI1.Mode = mciModeStop Then '返回设备的当前模式,(值524)mcimodenotopen没有打开,mcimodestop停止
'mcimodeplay在播放,mcimoderecord在录制,mcimodeeek在搜索,mcimodepause暂停,mcimodeready设备准备好
    MCI1.From = 0
    MCI1.Command = "play"
End If
If MCI2.Mode = mciModeStop Then
    MCI2.From = 0 'from属性指定开始播放的时间,to属性指定结束时间
    MCI2.Command = "play"
End If
If temp > 1000 Then
    Picture1.Cls 'cls清屏,绘图坐标回复到原点(0,0),缺省是左上角
    For i = 1 To 3
        Picture1.CurrentY = ScaleHeight - cury
        temp = Picture1.CurrentY 'currentX,currentY配合使用确认输出的坐标
        Picture1.ForeColor = QBColor(13)
        Picture1.Print " "; s1(i); " "; 'print这里表示在picture1中打印,末尾的分号表示不换行,输出多个字符串要用逗号或分号隔开,有区别
        Picture1.ForeColor = QBColor(10)
        Picture1.Print s2(i)
        cury = cury + 400
    Next i
    cury1 = cury1 + 200
End If
End Sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值