保存提取的icon 时,只有 8-bit 通道 icon 。 我如何获得 32位 icon? 下面是我使用的代码:
Public Sub LoadIcon()
Dim path = My.Computer.FileSystem.SpecialDirectories.Desktop +"icon"
Dim filePath As String ="С:/Windows/explorer.exe"
Dim TheIcon As Icon = IconFromFilePath(filePath)
If TheIcon IsNot Nothing Then
Using stream As New System.IO.FileStream(path +"programicon.ico", IO.FileMode.CreateNew)
TheIcon.Save(stream)
End Using
End If
PictureBox1.Load(path +"programicon.ico")
End Sub
Public Function IconFromFilePath(ByVal filePath As String) As Icon
Dim result As Icon = Nothing
Try
result = Icon.ExtractAssociatedIcon(filePath)
Catch
End Try
Return result
End Function
它正在返回这里 icon: