原创 VB调用webbrowser技巧集4收藏

1、如何使网页不出现滚动条:

Private Sub mnuScroll1_Click()
'注意:必须在网页完全显示之后才可以运行
    WebBrowser1.Document.body.Scroll = "no" '不显示滚动条的办法
End Sub
Private Sub mnuScroll2_Click()
'注意:必须在网页完全显示之后才可以运行
    WebBrowser1.Document.body.Scroll = "Auto" '显示滚动条的办法
End Sub

2、如何获得网页中被选中部分的HTML:

Private Sub Command1_Click()
    Dim objSelection
    Dim objTxtRange
   
    Set objSelection = WebBrowser1.Document.selection
    If Not (objSelection Is Nothing) Then
        Set objTxtRange = objSelection.createRange
        If Not (objTxtRange Is Nothing) Then
            Debug.Print objTxtRange.htmlText
       
            Set objTxtRange = Nothing
        End If
        Set objSelection = Nothing
    End If
End Sub

Private Sub Form_Load()
    WebBrowser1.Navigate "http://www.applevb.com"
End Sub

发表于 @ 2004年07月31日 04:48:00|评论(loading...)

新一篇: 建立在TaskBar上没有Item的Form(转载) | 旧一篇: vb调用Webbrowser技巧集3

用户操作
[即时聊天] [发私信] [加为好友]
陈锐
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
文章分类
收藏
    Graphics File Formats FAQ
    Adding Custom Buttons to Internet Explorer
    Creating a Windows DLL with Visual Basic
    Graphics File Formats FAQ (Part 1 of 4): General Graphics Format Questions
    Graphics File Formats FAQ (Part 2 of 4): Image Conversion and Display Programs
    Graphics File Formats FAQ (Part 3 of 4): Where to Get File Format Specifications
    Graphics File Formats FAQ (Part 4 of 4): Tips and Tricks of the Trade
    Visual Basic乱七八糟
    朋友的Blog
    小雨的Blog(RSS)
    瓜少之胡言乱语(RSS)
    美女苏胖墩的BLOG
    莫依的博客
    道士摄影
    马宁的Blog(RSS)
    我得主页
    AppleVB
    一些杂七杂八的东西
    40个常用的JS
    存档
    软件项目交易
    Csdn Blog version 3.1a
    Copyright © 陈锐