我没有尝试过任何工作...... 我尝试过的一切,我都看着互联网,但没有。 我下载它然后将其转换为.ico因为地球上没有托管服务提供商允许我上传RAW .ico并从网站上获取它们。 我想这个图标不可编辑。
这是我的代码
Imports System
Imports System.IO
Imports System.Text
Public Class Form2
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim logDirectoryProperties As System.IO.DirectoryInfo
If My.Computer.FileSystem.DirectoryExists("C:/fileexplorer") Then
Form1.Show()
Else
logDirectoryProperties = My.Computer.FileSystem.GetDirectoryInfo("C:/fileexplorer")
My.Computer.FileSystem.CreateDirectory("C:/fileexplorer")
Dim path As String = "C:/fileexplorer/lastactivity.log"
Dim fs As FileStream = File.Create(path)
Dim info As Byte() = New UTF8Encoding(True).GetBytes("")
fs.Write(info, 0, info.Length)
fs.Close()
My.Computer.Network.DownloadFile("http://icons.iconarchive.com/icons/cornmanthe3rd/plex/512/System-explorer-icon.png", "C:/fileexplorer/logo.png")
Dim img As Image = Image.FromFile("C:/fileexplorer/logo.png")
img.Save("C:/fileexplorer/logo_dont_edit.ico", System.Drawing.Imaging.ImageFormat.Icon)
Form1.Show()
End If
Me.Icon = New Icon("C:/fileexplorer/logo_dont_edit.ico")
End Sub
End Class
答案 0 :(得分:0)
您应该查看WebClient课程的DownloadFileAsync
方法。
Dim wc As New WebClient
AddHandler wc.DownloadFileCompleted, AddressOf FileDownloaded
wc.DownloadFileAsync(Uri, filename)
Private Sub FileDownloaded(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
'now assign image here as it has completed it's download
End Sub