楼主 zyg365 |
不用第三方控件播放Gif动画 WebBrowser显示GIF图片:无滚动条,可使GIF图片与窗体融为一体 Private Sub UserForm_Initialize() WebBrowser1.Navigate "about:blank" End Sub Private Sub UserForm_Activate() sPath = ThisWorkbook.Path & "\pic.gif" If VBA.Dir(sPath) = "" Then MsgBox "当前工作簿下未找到GIF图片(pic.gif)。", , "Excel助手:" End If Do While WebBrowser1.Busy DoEvents Loop With WebBrowser1.Document .Open .WriteLn "<HTML>" .WriteLn "<HEAD>" .WriteLn "<TITLE>" .WriteLn "</TITLE>" .WriteLn "</HEAD>" .WriteLn "<style TYPE=" & Chr(34) & "text/css" & Chr(34) & ">" .WriteLn "<!--" .WriteLn "A:link{text-decoration:none}" .WriteLn "A:visited{text-decoration:none}" .WriteLn "A:hover {color: #ff00ff;text-decoration:underline}" '.WriteLn "body {background-color:#ece9d8;border:none}" '可使图片与窗体融为一体 .WriteLn "body {background-color:buttonface;border:none}" '可使图片与窗体融为一体 .WriteLn "-->" .WriteLn "</style>" .WriteLn "<BODY scroll=" & VBA.Chr(34) & "no" & VBA.Chr(34) & " oncontextmenu=self.event.returnValue=false>" .WriteLn "<div style=" & VBA.Chr(34) & "position:absolute; left: 0; top: 0" & VBA.Chr(34) & ">" .WriteLn "<IMG SRC=" & VBA.Chr(34) & sPath & VBA.Chr(34) & " BORDER=" & VBA.Chr(34) & "0" & VBA.Chr(34) & ">" .WriteLn "</div>" .WriteLn "</BODY>" .WriteLn "</HTML>" End With WebBrowser1.Refresh2 End Sub part1.rar part2.rar part3.rar part4.rar |
2楼 wise |
署名作者: 张元光 改一下为: 署名作者: zyg365 |