From: Herfried K. Wagner [MVP] on
Am 18.12.2009 13:33, schrieb yxq:
> Application.EnableVisualStyles()
> Imagelist.ColorDepth = ColorDepth.Depth32Bit
> But the icon seem no 32bit, the color is not full, it's ugly, why?

Kindly post the code you use to extract the icon and to add it to the
image list.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
From: Armin Zingler on
yxq schrieb:
> The code is below, thank you.
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////
> Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA"
> (ByVal hInst As IntPtr, ByVal lpszExeFileName As String, ByVal nIconIndex As
> Integer) As IntPtr
>
> Public Function ExtractIcons(ByVal iconfile As String, ByVal iconindex As
> Int32) As Icon
> Try
> Dim hIcon As IntPtr
> hIcon =
> ExtractIcon(System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)),
> iconfile, iconindex)

I guess it's not the problem, but according to the documentation of the ExtractIcon function,
the first argument must be NULL (Intptr.Zero).


Also have a look at the Icon.ExtractAssociatedIcon function.


--
Armin