'An idea: use an invisible webbrowser1 to show the image url ,then copy the image to picture1 Private Sub Form_Load() WebBrowser1.Visible = False Picture1.AutoSize = True End SubPrivate Sub Command1_Click() WebBrowser1.Navigate "http://community.csdn.net/logo/Images/eye001.gif", 0 End SubPrivate Sub WebBrowser1_DownloadComplete() Dim a, range For Each a In WebBrowser1.Document.All If a.tagName = "IMG" Then WebBrowser1.Stop Set range = WebBrowser1.Document.body.createControlRange() range.Add (a) range.execCommand ("Copy") Picture1.Picture = Clipboard.GetData(vbCFBitmap) End If Next End Sub
用WebBrowser1:
WebBrowser1.Navigate ("d:\mis-yz\pic\tiaowu.gif") '可以是http://.../pic.jpg
有哪位用过Scriptlet这个控件?它的url属性怎么附值?在属性对话框中可以输入,为什么在代码中直接附值却不行?
Private Sub Form_Load()
WebBrowser1.Visible = False
Picture1.AutoSize = True
End SubPrivate Sub Command1_Click()
WebBrowser1.Navigate "http://community.csdn.net/logo/Images/eye001.gif", 0
End SubPrivate Sub WebBrowser1_DownloadComplete()
Dim a, range
For Each a In WebBrowser1.Document.All
If a.tagName = "IMG" Then
WebBrowser1.Stop
Set range = WebBrowser1.Document.body.createControlRange()
range.Add (a)
range.execCommand ("Copy")
Picture1.Picture = Clipboard.GetData(vbCFBitmap)
End If
Next
End Sub