用vb.net写一个简易的RSS阅读器

简介: 先发一个做出来的效果图哈哈!怎么样?对了DUDU,我这个还解决了看天下那个阅读器不能正常显示相对路径的图片的问题哟!现在不管相对的还是绝对的路径的图片都能正常显示哈!下面是源代码,没有太多注释,因为都比较简单嘛! Imports System.
先发一个做出来的效果图
rssreader.JPG
哈哈!怎么样?对了DUDU,我这个还解决了看天下那个阅读器不能正常显示相对路径的图片的问题哟!
现在不管相对的还是绝对的路径的图片都能正常显示哈!

下面是源代码,没有太多注释,因为都比较简单嘛!
img_a6339ee3e57d1d52bc7d02b338e15a60.gif Imports  System.Xml
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
Imports  System.Threading
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
Public   Class Form1 Class Form1
img_33d02437d135341f0800e3d415312ae8.gif    
Inherits System.Windows.Forms.Form
img_33d02437d135341f0800e3d415312ae8.gif#Region 
" Windows 窗体设计器生成的代码 "
img_33d02437d135341f0800e3d415312ae8.gif

img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
    Public Sub New()Sub New()
img_33d02437d135341f0800e3d415312ae8.gif        
MyBase.New()
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
'该调用是 Windows 窗体设计器所必需的。
img_33d02437d135341f0800e3d415312ae8.gif
        InitializeComponent()
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
'在 InitializeComponent() 调用之后添加任何初始化
img_33d02437d135341f0800e3d415312ae8.gif

img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif    
'窗体重写 dispose 以清理组件列表。
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
    Protected Overloads Overrides Sub Dispose()Sub Dispose(ByVal disposing As Boolean)
img_33d02437d135341f0800e3d415312ae8.gif        
If disposing Then
img_33d02437d135341f0800e3d415312ae8.gif            
If Not (components Is NothingThen
img_33d02437d135341f0800e3d415312ae8.gif                components.Dispose()
img_33d02437d135341f0800e3d415312ae8.gif            
End If
img_33d02437d135341f0800e3d415312ae8.gif        
End If
img_33d02437d135341f0800e3d415312ae8.gif        
MyBase.Dispose(disposing)
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif    
'Windows 窗体设计器所必需的
img_33d02437d135341f0800e3d415312ae8.gif
    Private components As System.ComponentModel.IContainer
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif    
'注意: 以下过程是 Windows 窗体设计器所必需的
img_33d02437d135341f0800e3d415312ae8.gif
    '可以使用 Windows 窗体设计器修改此过程。
img_33d02437d135341f0800e3d415312ae8.gif
    '不要使用代码编辑器修改它。
img_33d02437d135341f0800e3d415312ae8.gif
    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents Button1 As System.Windows.Forms.Button
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents Label1 As System.Windows.Forms.Label
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents Label2 As System.Windows.Forms.Label
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
img_33d02437d135341f0800e3d415312ae8.gif    
Friend WithEvents Label4 As System.Windows.Forms.Label
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()Sub InitializeComponent()
img_33d02437d135341f0800e3d415312ae8.gif        
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
img_33d02437d135341f0800e3d415312ae8.gif        Me.ListBox1 
= New System.Windows.Forms.ListBox
img_33d02437d135341f0800e3d415312ae8.gif        Me.Button1 
= New System.Windows.Forms.Button
img_33d02437d135341f0800e3d415312ae8.gif        Me.AxWebBrowser1 
= New AxSHDocVw.AxWebBrowser
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label1 
= New System.Windows.Forms.Label
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label2 
= New System.Windows.Forms.Label
img_33d02437d135341f0800e3d415312ae8.gif        Me.TextBox1 
= New System.Windows.Forms.TextBox
img_33d02437d135341f0800e3d415312ae8.gif        Me.StatusBar1 
= New System.Windows.Forms.StatusBar
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label4 
= New System.Windows.Forms.Label
img_33d02437d135341f0800e3d415312ae8.gif        
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit()
img_33d02437d135341f0800e3d415312ae8.gif        Me.SuspendLayout()
img_33d02437d135341f0800e3d415312ae8.gif        
'
img_33d02437d135341f0800e3d415312ae8.gif
        'ListBox1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.ListBox1.ItemHeight = 12
img_33d02437d135341f0800e3d415312ae8.gif        Me.ListBox1.Location 
= New System.Drawing.Point(072)
img_33d02437d135341f0800e3d415312ae8.gif        Me.ListBox1.Name 
= "ListBox1"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.ListBox1.Size = New System.Drawing.Size(872124)
img_33d02437d135341f0800e3d415312ae8.gif        Me.ListBox1.TabIndex 
= 0
img_33d02437d135341f0800e3d415312ae8.gif        
'
img_33d02437d135341f0800e3d415312ae8.gif
        'Button1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Button1.Location = New System.Drawing.Point(7600)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Button1.Name 
= "Button1"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Button1.Size = New System.Drawing.Size(11272)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Button1.TabIndex 
= 1
img_33d02437d135341f0800e3d415312ae8.gif        Me.Button1.Text 
= "读取"
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        'AxWebBrowser1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.AxWebBrowser1.Enabled = True
img_33d02437d135341f0800e3d415312ae8.gif        Me.AxWebBrowser1.Location 
= New System.Drawing.Point(0208)
img_33d02437d135341f0800e3d415312ae8.gif        Me.AxWebBrowser1.OcxState 
= CType(resources.GetObject("AxWebBrowser1.OcxState"), System.Windows.Forms.AxHost.State)
img_33d02437d135341f0800e3d415312ae8.gif        Me.AxWebBrowser1.Size 
= New System.Drawing.Size(872512)
img_33d02437d135341f0800e3d415312ae8.gif        Me.AxWebBrowser1.TabIndex 
= 2
img_33d02437d135341f0800e3d415312ae8.gif        
'
img_33d02437d135341f0800e3d415312ae8.gif
        'Label1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Label1.Location = New System.Drawing.Point(2432)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label1.Name 
= "Label1"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Label1.Size = New System.Drawing.Size(72816)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label1.TabIndex 
= 3
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label1.Text 
= "网站:"
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        'Label2
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Label2.Location = New System.Drawing.Point(2448)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label2.Name 
= "Label2"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Label2.Size = New System.Drawing.Size(72816)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label2.TabIndex 
= 4
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label2.Text 
= "描述:"
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        'TextBox1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.TextBox1.Location = New System.Drawing.Point(880)
img_33d02437d135341f0800e3d415312ae8.gif        Me.TextBox1.Name 
= "TextBox1"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.TextBox1.Size = New System.Drawing.Size(66421)
img_33d02437d135341f0800e3d415312ae8.gif        Me.TextBox1.TabIndex 
= 6
img_33d02437d135341f0800e3d415312ae8.gif        Me.TextBox1.Text 
= "http://www.cnblogs.com/aowind/Rss.aspx"
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        'StatusBar1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.StatusBar1.Location = New System.Drawing.Point(0725)
img_33d02437d135341f0800e3d415312ae8.gif        Me.StatusBar1.Name 
= "StatusBar1"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.StatusBar1.Size = New System.Drawing.Size(87224)
img_33d02437d135341f0800e3d415312ae8.gif        Me.StatusBar1.TabIndex 
= 7
img_33d02437d135341f0800e3d415312ae8.gif        Me.StatusBar1.Text 
= "StatusBar1"
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        'Label4
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Label4.Location = New System.Drawing.Point(168)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label4.Name 
= "Label4"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.Label4.Size = New System.Drawing.Size(6416)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label4.TabIndex 
= 8
img_33d02437d135341f0800e3d415312ae8.gif        Me.Label4.Text 
= "RSS地址:"
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        'Form1
img_33d02437d135341f0800e3d415312ae8.gif
        '
img_33d02437d135341f0800e3d415312ae8.gif
        Me.AutoScaleBaseSize = New System.Drawing.Size(614)
img_33d02437d135341f0800e3d415312ae8.gif        Me.ClientSize 
= New System.Drawing.Size(872749)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.Label4)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.StatusBar1)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.TextBox1)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.Label2)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.Label1)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.AxWebBrowser1)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.Button1)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Controls.Add(Me.ListBox1)
img_33d02437d135341f0800e3d415312ae8.gif        Me.Name 
= "Form1"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
img_33d02437d135341f0800e3d415312ae8.gif        Me.Text 
= "简易RSS阅读器"
img_33d02437d135341f0800e3d415312ae8.gif
        CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit()
img_33d02437d135341f0800e3d415312ae8.gif        Me.ResumeLayout(
False)
img_33d02437d135341f0800e3d415312ae8.gif
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif#
End Region
img_33d02437d135341f0800e3d415312ae8.gif    
Private thread As thread '定义一个线程
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
    Private Sub loadrss()Sub loadrss() '读取RSS文件并取出内容标题的过程
img_33d02437d135341f0800e3d415312ae8.gif
        StatusBar1.Text = "正在读取" & TextBox1.Text & "并效验img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.loadxmltocache(TextBox1.Text)
img_33d02437d135341f0800e3d415312ae8.gif        StatusBar1.Text 
= "正在读取相关网站信息img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.loadtitle()
img_33d02437d135341f0800e3d415312ae8.gif        StatusBar1.Text 
= "正在读取相RSS内容项img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif"
img_33d02437d135341f0800e3d415312ae8.gif
        Me.loaditem()
img_33d02437d135341f0800e3d415312ae8.gif        StatusBar1.Text 
= "完成"
img_105a1e124122b2abcee4ea8e9f5108f3.gif
    End Sub

img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click
img_33d02437d135341f0800e3d415312ae8.gif        
Try
img_33d02437d135341f0800e3d415312ae8.gif            thread 
= New Thread(AddressOf loadrss)
img_33d02437d135341f0800e3d415312ae8.gif            thread.Start()
img_33d02437d135341f0800e3d415312ae8.gif        
Catch ex As Exception
img_33d02437d135341f0800e3d415312ae8.gif            
MsgBox(ex.ToString)
img_33d02437d135341f0800e3d415312ae8.gif        
End Try
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load
img_33d02437d135341f0800e3d415312ae8.gif        AxWebBrowser1.Width 
= Me.Width
img_33d02437d135341f0800e3d415312ae8.gif        StatusBar1.Text 
= "就绪"
img_105a1e124122b2abcee4ea8e9f5108f3.gif
    End Sub

img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub loadxmltocache()Sub loadxmltocache(ByVal URL As String)
img_33d02437d135341f0800e3d415312ae8.gif        
'读取RSS文件并存放在本地以供操作
img_33d02437d135341f0800e3d415312ae8.gif
        Dim xmldocument As New XmlDocument
img_33d02437d135341f0800e3d415312ae8.gif        xmldocument.Load(URL)
img_33d02437d135341f0800e3d415312ae8.gif        xmldocument.Save(Application.StartupPath 
& "~doc.xml")
img_33d02437d135341f0800e3d415312ae8.gif
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub loadtitle()Sub loadtitle()
img_33d02437d135341f0800e3d415312ae8.gif        
'从本地文件中进行操作,读取RSS中有关网站的信息
img_33d02437d135341f0800e3d415312ae8.gif
        Dim xmlDocument As New XmlDocument
img_33d02437d135341f0800e3d415312ae8.gif        xmlDocument.Load(Application.StartupPath 
& "~doc.xml")
img_33d02437d135341f0800e3d415312ae8.gif        
Dim mynodelist As XmlNodeList
img_33d02437d135341f0800e3d415312ae8.gif        mynodelist 
= xmlDocument.SelectNodes("/rss/channel")
img_33d02437d135341f0800e3d415312ae8.gif        Label1.Text 
= "网站:" & Trim(mynodelist(0).Item("title").InnerText())
img_33d02437d135341f0800e3d415312ae8.gif        Label2.Text 
= "描述:" & Trim(mynodelist(0).Item("description").InnerText())
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub loaditem()Sub loaditem()
img_33d02437d135341f0800e3d415312ae8.gif        
'从本地文件中进行操作,读取RSS中内容的标题及作者
img_33d02437d135341f0800e3d415312ae8.gif
        Dim xmlDocument As New XmlDocument
img_33d02437d135341f0800e3d415312ae8.gif        xmlDocument.Load(Application.StartupPath 
& "~doc.xml")
img_33d02437d135341f0800e3d415312ae8.gif        
Dim mynodelist As XmlNodeList
img_33d02437d135341f0800e3d415312ae8.gif        mynodelist 
= xmlDocument.SelectNodes("/rss/channel/item")
img_33d02437d135341f0800e3d415312ae8.gif        ListBox1.Items.Clear()
img_33d02437d135341f0800e3d415312ae8.gif        
Dim i As Integer
img_33d02437d135341f0800e3d415312ae8.gif        
For i = 0 To mynodelist.Count - 1
img_33d02437d135341f0800e3d415312ae8.gif            ListBox1.Items.Add(
"[" & Trim(mynodelist(i).Item("dc:creator").InnerText()) & "]" & Trim(mynodelist(i).Item("title").InnerText()))
img_33d02437d135341f0800e3d415312ae8.gif        
Next
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub ListBox1_SelectedIndexChanged()Sub ListBox1_SelectedIndexChanged(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
img_33d02437d135341f0800e3d415312ae8.gif        thread 
= New Thread(AddressOf loadhtml)
img_33d02437d135341f0800e3d415312ae8.gif        thread.Start()
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Sub

img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
Private Sub loadhtml()Sub loadhtml()
img_33d02437d135341f0800e3d415312ae8.gif        
'读取RSS中对应文件的内容并存到临时文件后显示
img_33d02437d135341f0800e3d415312ae8.gif
        Dim xmlDocument As New XmlDocument
img_33d02437d135341f0800e3d415312ae8.gif        xmlDocument.Load(Application.StartupPath 
& "~doc.xml")
img_33d02437d135341f0800e3d415312ae8.gif        
Dim mynodelist As XmlNodeList
img_33d02437d135341f0800e3d415312ae8.gif        mynodelist 
= xmlDocument.SelectNodes("/rss/channel/item")
img_33d02437d135341f0800e3d415312ae8.gif        
Dim i As Integer
img_33d02437d135341f0800e3d415312ae8.gif        
Dim j As Boolean
img_33d02437d135341f0800e3d415312ae8.gif        
Dim content As String
img_33d02437d135341f0800e3d415312ae8.gif        StatusBar1.Text 
= "正在读取文章内容img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif"
img_33d02437d135341f0800e3d415312ae8.gif
        For i = 0 To mynodelist.Count - 1
img_33d02437d135341f0800e3d415312ae8.gif            
If ListBox1.SelectedItem = "[" & Trim(mynodelist(i).Item("dc:creator").InnerText()) & "]" & Trim(mynodelist(i).Item("title").InnerText()) Then
img_33d02437d135341f0800e3d415312ae8.gif                content 
= content & "<html><head><meta http-equiv='content-type' content='text/html;charset=UTF-8'></head><body>"
img_33d02437d135341f0800e3d415312ae8.gif
                content = content & "<table width='100%' height='80' bgcolor='#eeeeee'><tr><td><b>标题:</b><a href='"
img_33d02437d135341f0800e3d415312ae8.gif
                content = content & Trim(mynodelist(i).Item("link").InnerText())
img_33d02437d135341f0800e3d415312ae8.gif                content 
= content & "' target='_blank'>"
img_33d02437d135341f0800e3d415312ae8.gif
                content = content & Trim(mynodelist(i).Item("title").InnerText())
img_33d02437d135341f0800e3d415312ae8.gif                content 
= content & "</a><br><b>作者:</b>"
img_33d02437d135341f0800e3d415312ae8.gif
                content = content & Trim(mynodelist(i).Item("dc:creator").InnerText())
img_33d02437d135341f0800e3d415312ae8.gif                content 
= content & "</tb></tr></table>"
img_33d02437d135341f0800e3d415312ae8.gif
                content = content & formatHtml(mynodelist(i).Item("description").InnerText())
img_33d02437d135341f0800e3d415312ae8.gif                content 
= content & "</body></html>"
img_33d02437d135341f0800e3d415312ae8.gif
                j = SaveTextFile(Application.StartupPath & "~temp.html", content)
img_33d02437d135341f0800e3d415312ae8.gif                AxWebBrowser1.Navigate(Application.StartupPath 
& "~temp.html")
img_33d02437d135341f0800e3d415312ae8.gif                
Exit For
img_33d02437d135341f0800e3d415312ae8.gif            
End If
img_33d02437d135341f0800e3d415312ae8.gif        
Next
img_33d02437d135341f0800e3d415312ae8.gif        StatusBar1.Text 
= "完成"
img_105a1e124122b2abcee4ea8e9f5108f3.gif
    End Sub

img_33d02437d135341f0800e3d415312ae8.gif    
'写文件的过程
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
    Function SaveTextFile()Function SaveTextFile(ByVal FilePath As StringByVal FileContent As StringAs Boolean
img_33d02437d135341f0800e3d415312ae8.gif        
Dim sw As System.IO.StreamWriter
img_33d02437d135341f0800e3d415312ae8.gif        
Try
img_33d02437d135341f0800e3d415312ae8.gif            sw 
= New System.IO.StreamWriter(FilePath, False)
img_33d02437d135341f0800e3d415312ae8.gif            sw.
Write(FileContent)
img_33d02437d135341f0800e3d415312ae8.gif            
Return True
img_33d02437d135341f0800e3d415312ae8.gif        
Catch e As Exception
img_33d02437d135341f0800e3d415312ae8.gif            
Return False
img_33d02437d135341f0800e3d415312ae8.gif        
Finally
img_33d02437d135341f0800e3d415312ae8.gif            
If Not sw Is Nothing Then sw.Close()
img_33d02437d135341f0800e3d415312ae8.gif        
End Try
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Function

img_33d02437d135341f0800e3d415312ae8.gif    
'从地址里取网址的函数
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
    Private Function formatURL()Function formatURL(ByVal str As StringAs String
img_33d02437d135341f0800e3d415312ae8.gif        
Dim sStr As String
img_33d02437d135341f0800e3d415312ae8.gif        
Dim i As Integer
img_33d02437d135341f0800e3d415312ae8.gif        
Dim j As Integer
img_33d02437d135341f0800e3d415312ae8.gif        
For i = 1 To Len(str)
img_33d02437d135341f0800e3d415312ae8.gif            sStr 
= sStr & Mid(str, i, 1)
img_33d02437d135341f0800e3d415312ae8.gif            
If Mid(str, i, 1= "/" Then
img_33d02437d135341f0800e3d415312ae8.gif                j 
+= 1
img_33d02437d135341f0800e3d415312ae8.gif            
End If
img_33d02437d135341f0800e3d415312ae8.gif            
If j = 3 Then Exit For
img_33d02437d135341f0800e3d415312ae8.gif        
Next
img_33d02437d135341f0800e3d415312ae8.gif        
Return sStr
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Function

img_33d02437d135341f0800e3d415312ae8.gif    
'将内容里的相对图片地址改成绝对地址的函数
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
    Private Function formatHtml()Function formatHtml(ByVal str As StringAs String
img_33d02437d135341f0800e3d415312ae8.gif        
Return Replace(str"src=" & Chr(34& "/""src =" & Chr(34& formatURL(TextBox1.Text))
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
End Function

img_05dd8d549cff04457a6366b0a7c9352a.gif
End Class

当然还有好多功能没完成,比如收藏RSS地址、是否已读、自动更新。
所以叫简易RSS阅读器嘛!参考一下!
相关文章
|
5月前
|
C# Windows
一款.NET开源、简洁易用的Windows桌面小说阅读应用
一款.NET开源、简洁易用的Windows桌面小说阅读应用
|
机器学习/深度学习 算法 计算机视觉
EagleEye: Fast Sub-net Evaluation for Efficient Neural Network Pruning(论文阅读)(下)
说明 动机 贡献 方法 发现 EagleEye剪枝算法 实验 实验1- 相关性的定量分析 实验2-基于自适应BN的评估方法的通用性 实验3-从修剪候选中选择最佳修剪策略的计算成本 实验4-Effectiveness of our proposed method 总结与讨论
141 0
EagleEye: Fast Sub-net Evaluation for Efficient Neural Network Pruning(论文阅读)(下)
|
机器学习/深度学习 算法 计算机视觉
EagleEye: Fast Sub-net Evaluation for Efficient Neural Network Pruning(论文阅读)(上)
说明 动机 贡献 方法 发现 EagleEye剪枝算法 实验 实验1- 相关性的定量分析 实验2-基于自适应BN的评估方法的通用性 实验3-从修剪候选中选择最佳修剪策略的计算成本 实验4-Effectiveness of our proposed method 总结与讨论
177 0
EagleEye: Fast Sub-net Evaluation for Efficient Neural Network Pruning(论文阅读)(上)
|
Windows
利用.NET做“电子书阅读器”原来这么简单(其实你也可以做出金山词霸)
一、利用.NET做“电子书阅读器”原来这么简单 先下载组件:Interop.SpeechLib.dll  (http://files.cnblogs.com/waw/Interop.SpeechLib.
1184 0
|
并行计算 .NET C#
浅谈.NET下的多线程和并行计算(十三)CLR via C#第三版阅读笔记(2)
线程同步的问题 1) 我们必须找到代码中所有可能被多个线程同时访问的资源,然后使用线程同步来保护资源,并且我们没有办法来验证是不是正确进行了线程同步,包括是否有遗漏和是否对不需要同步的资源进行同步。 2) 线程同步是有损性能的,如果某个操作大量执行,并且这个操作原先的执行时间非常短,那么如果我们对这段操作前后进行锁的申请和释放的话性能可能下降一个数量级。
919 0
|
XML .NET C#
开发,配置,调用-三步走构建简单的asp.net webservice(C#)-适合初学者阅读
http://www.cnblogs.com/farrah/archive/2009/04/03/1429099.html   前两天,工作中遇到需要开发一个简单的webservice 网上搜索了不少文章,可是讲的很全面的还真是不多。
1183 0
|
XML 定位技术 C#
ASP.NET的SEO:Linq to XML---网站地图和RSS Feed
本系列目录网站地图的作用是让搜索引擎尽快的,更多的收录网站的各个网页。    这里我们首先要明白一个基本的原理,搜索引擎的爬行方式。整个互联网就像一张纵横交错的“网”:网的各个节点就是各个网页,而各个网页之间通过url相互连接。
1041 0
下一篇
无影云桌面