当我保存提取的图标时,我只有 8 位通道图标。如何获得 32 位图标?这是我使用的代码:
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
它返回这个图标: