在图片框中显示来自网站的图像

时间:2015-12-06 20:20:16

标签: vb.net visual-studio-2010 picturebox

我在图片框中显示来自网站的图片时遇到问题,因为该网站将此代码用于图片:

<img src="showImage" id="secimage" style="border:none;height: 40px" />

我在Visual Basic中创建了一个Web浏览器来打开该站点。我想在图片框中显示这个特定的图像。我目前的代码:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate("http://www.mypicsite.com")
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

        ***this is the picture fox in which i have to show a image from
        WebBrowser1(www.mypicsite.com)
        My pic site havve image with tag-
            <img src="showImage" id="secimage" style="border:none;height: 40px" />
        please help me.***

    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

使用以下代码。替换你的URL。

PictureBox1.Image = New System.Drawing.Bitmap(New IO.MemoryStream(New System.Net.WebClient().DownloadData("YOUR_IMAGE_URL")))