在VB中插入Gif动画
chengd222吧
全部回复
仅看楼主
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
level 1
楼主sb
2011年06月13日 13点06分 2
level 15
自古二楼出SB,这话一点没错,我发我的代码,我写我的程序,招你惹你了?
2011年06月13日 23点06分 3
1