如何使用vb.net将图像从Dropbox插入图片框?

时间:2017-08-01 03:37:56

标签: vb.net dropbox

我想使用vb.net将Dropbox中的图像插入到图片框中。我需要任何声明来获取图像吗?下面的代码是否正确?

PictureBox1.ImageLocation = ("https://www.dropbox.com/sh/ygv9rcyh3mau9iq/AACMZkQk1LjJQtHhHfnQtJnya?dl=0")

感谢。

此致 贝拉

1 个答案:

答案 0 :(得分:1)

右键图片并获取完整的图片链接。 使用webclient下载图片。 将其转换为图像并显示它:

Dim wc as WebClient = new WebClient()
Dim link as String = "https://photos-2.dropbox.com/t/2/AACerj-io8r78s9wMuMj89u6oImFJ3DBeSkMCqTdCHNh3g/12/251283012/jpeg/32x32/3/1501606800/0/2/Red.jpg/EJuPkuUBGEIgAigCKAQ/UMjbxEdbmCCNu2OKt_ilUDfYTahaFP6-V2bmbT4g6pM?dl=0&size=1600x1200&size_mode=3"
Dim mem as new MemoryStream(wc.DownloadData(link ))
Dim img as Bitmap = Bitmap.FromStream(mem )
PictureBox1.Image = img