如何利用 WebBrowser 控件,显示 .GIF 动画?
来源:互联网 发布:知无涯者观后感 编辑:程序博客网 时间:2024/06/07 12:42
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
注意细节:
没有"滚动条"和"鼠标右键弹出的 IE 上下文菜单",".HTM 源文件" ...
我写了一个,效果还真不错!
'Objects: Form1、Command1、CommonDialog1、WebBrowser1
Option Explicit
Private Sub Command1_Click()
CommonDialog1.ShowOpen
If VBA.Len(VBA.Trim(CommonDialog1.FileName)) > 0 Then
Dim p As stdole.StdPicture
Dim sPath As String
sPath = VBA.Trim(VBA.Trim(CommonDialog1.FileName))
Set p = VB.LoadPicture(sPath)
WebBrowser1.Width = p.Width * 16 / 26
WebBrowser1.Height = p.Height * 16 / 26
' WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.open
WebBrowser1.Document.writeln "<HTML>"
WebBrowser1.Document.writeln "<HEAD>"
WebBrowser1.Document.writeln "<TITLE>"
WebBrowser1.Document.writeln "</TITLE>"
WebBrowser1.Document.writeln "</HEAD>"
WebBrowser1.Document.writeln "<BODY scroll=" & VBA.Chr(34) & "no" & VBA.Chr(34) & " oncontextmenu=self.event.returnValue=false>"
WebBrowser1.Document.writeln "<div style=" & VBA.Chr(34) & "position:absolute; left: 0; top: 0" & VBA.Chr(34) & ">"
WebBrowser1.Document.writeln "<IMG SRC=" & VBA.Chr(34) & sPath & VBA.Chr(34) & " BORDER=" & VBA.Chr(34) & "0" & VBA.Chr(34) & ">"
WebBrowser1.Document.writeln "</div>"
WebBrowser1.Document.writeln "</BODY>"
WebBrowser1.Document.writeln "</HTML>"
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "&Open"
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.open
WebBrowser1.Document.writeln "<HTML>"
WebBrowser1.Document.writeln "<HEAD>"
WebBrowser1.Document.writeln "<TITLE>"
WebBrowser1.Document.writeln "</TITLE>"
WebBrowser1.Document.writeln "</HEAD>"
WebBrowser1.Document.writeln "<BODY scroll=" & VBA.Chr(34) & "no" & VBA.Chr(34) & " oncontextmenu=self.event.returnValue=false>"
WebBrowser1.Document.writeln "</BODY>"
WebBrowser1.Document.writeln "</HTML>"
WebBrowser1.Document.Close
End Sub <script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
要有一定的网页知识(HTML、JavaScript、CSS)注意细节:
没有"滚动条"和"鼠标右键弹出的 IE 上下文菜单",".HTM 源文件" ...
我写了一个,效果还真不错!
'Objects: Form1、Command1、CommonDialog1、WebBrowser1
Option Explicit
Private Sub Command1_Click()
CommonDialog1.ShowOpen
If VBA.Len(VBA.Trim(CommonDialog1.FileName)) > 0 Then
Dim p As stdole.StdPicture
Dim sPath As String
sPath = VBA.Trim(VBA.Trim(CommonDialog1.FileName))
Set p = VB.LoadPicture(sPath)
WebBrowser1.Width = p.Width * 16 / 26
WebBrowser1.Height = p.Height * 16 / 26
' WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.open
WebBrowser1.Document.writeln "<HTML>"
WebBrowser1.Document.writeln "<HEAD>"
WebBrowser1.Document.writeln "<TITLE>"
WebBrowser1.Document.writeln "</TITLE>"
WebBrowser1.Document.writeln "</HEAD>"
WebBrowser1.Document.writeln "<BODY scroll=" & VBA.Chr(34) & "no" & VBA.Chr(34) & " oncontextmenu=self.event.returnValue=false>"
WebBrowser1.Document.writeln "<div style=" & VBA.Chr(34) & "position:absolute; left: 0; top: 0" & VBA.Chr(34) & ">"
WebBrowser1.Document.writeln "<IMG SRC=" & VBA.Chr(34) & sPath & VBA.Chr(34) & " BORDER=" & VBA.Chr(34) & "0" & VBA.Chr(34) & ">"
WebBrowser1.Document.writeln "</div>"
WebBrowser1.Document.writeln "</BODY>"
WebBrowser1.Document.writeln "</HTML>"
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "&Open"
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.open
WebBrowser1.Document.writeln "<HTML>"
WebBrowser1.Document.writeln "<HEAD>"
WebBrowser1.Document.writeln "<TITLE>"
WebBrowser1.Document.writeln "</TITLE>"
WebBrowser1.Document.writeln "</HEAD>"
WebBrowser1.Document.writeln "<BODY scroll=" & VBA.Chr(34) & "no" & VBA.Chr(34) & " oncontextmenu=self.event.returnValue=false>"
WebBrowser1.Document.writeln "</BODY>"
WebBrowser1.Document.writeln "</HTML>"
WebBrowser1.Document.Close
End Sub <script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 如何利用 WebBrowser 控件,显示 .GIF 动画?
- 利用GDI+显示GIF动画
- 利用webview显示gif动画
- VB利用PictureBox控件播放GIF动画
- PictureBox控件中显示GIF动画(图片)
- 如何在Delphi中显示GIF动画
- 一个可以显示图片(包括GIF动画)的ATL控件,以及在RichEdit中如何使用此控件插入图片
- 一个可以显示图片(包括GIF动画)的ATL控件,以及在RichEdit中如何使用此控件插入图片
- 使用定时器显示GIF动画的ATL控件实现
- 使用定时器显示GIF动画的ATL控件实现
- 使用定时器显示GIF动画的ATL控件实现
- GifView——Android显示GIF动画的扩展控件
- GDI+显示GIF动画
- GDI+显示GIF动画
- GDI+显示GIF动画
- GDI+显示GIF动画
- GDI+显示GIF动画
- 显示GIF动画
- 包含中文字符的URL编码问题
- 使用javascript xml实现分页
- 使用xml http为网站增加域名查询功能
- 用VB5 Winsock控件创建TCPIP客户机 服务器程序
- 使用xmldom在服务器端生成静态html页面
- 如何利用 WebBrowser 控件,显示 .GIF 动画?
- Web设计中如何使用XML数据源对象(2)
- 关于如何使用ADO连接数据库
- Web设计中如何使用XML数据源对象(1)
- VB访问数据库的方案比较
- 学习使用XML引擎XQEngine
- 开机自动更换墙纸
- 论Asp与XML的关系
- 完全用 VB 6.0 自身功能实现对 Windows 消息的拦截!