level 15
放飞希望,追逐梦想
楼主
先引用 ActiveMovie control type library
在窗体上放一个图片框Picture1
代码:
Option Explicit
Private pMC As FilgraphManager '定义pMC为FilgraphManager对象
Private pVW As IVideoWindow '定义pVW为IVideoWindow对象
Private Sub Form_Load()
Me.ScaleMode = 3
Picture1.ScaleMode = 3
On Error Resume Next
Set pMC = New FilgraphManager
pMC.Stop
pMC.RenderFile ""
'加载GIF文件
On Error GoTo Lhandle
pMC.RenderFile App.Path & "\图片.gif" '加载GIF动画(图片)
On Error Resume Next
Set pVW = pMC
pVW.WindowStyle = CLng(&H6000000)
'限定动画在Picture1的大小中
pVW.Left = 0: pVW.Top = 0
Picture1.Width = pVW.Width
Picture1.Height = pVW.Height
pVW.Owner = Picture1.hWnd '在Picture1中显示
pVW.MessageDrain = Picture1.hWnd '此行非常重要,用来定义动画的右键菜单所必须
pMC.Run
Exit Sub
Lhandle:
MsgBox "加载文件错误!"
End Sub
2011年06月10日 07点06分
1
在窗体上放一个图片框Picture1
代码:
Option Explicit
Private pMC As FilgraphManager '定义pMC为FilgraphManager对象
Private pVW As IVideoWindow '定义pVW为IVideoWindow对象
Private Sub Form_Load()
Me.ScaleMode = 3
Picture1.ScaleMode = 3
On Error Resume Next
Set pMC = New FilgraphManager
pMC.Stop
pMC.RenderFile ""
'加载GIF文件
On Error GoTo Lhandle
pMC.RenderFile App.Path & "\图片.gif" '加载GIF动画(图片)
On Error Resume Next
Set pVW = pMC
pVW.WindowStyle = CLng(&H6000000)
'限定动画在Picture1的大小中
pVW.Left = 0: pVW.Top = 0
Picture1.Width = pVW.Width
Picture1.Height = pVW.Height
pVW.Owner = Picture1.hWnd '在Picture1中显示
pVW.MessageDrain = Picture1.hWnd '此行非常重要,用来定义动画的右键菜单所必须
pMC.Run
Exit Sub
Lhandle:
MsgBox "加载文件错误!"
End Sub