1

当我保存提取的图标时,我只有 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

它返回这个图标:

在此处输入图像描述

4

1 回答 1

0

尝试使用 shgetfileinfo 找到最大的图标,也许如果您使用SHIL_LASTSHIL_JUMBO(从 Windows Vista 开始)您会找到 32 位彩色图标。更多信息SHIL_LASTSHIL_JUMBO您可以在此处找到。

于 2013-07-25T11:51:52.823 回答