-
1 Attachment(s)
List View Icons
I have a list view that I am listing files in a directory along their the corresponding icons. The problem I have is that some of the icons are not getting a transparent background (see attached).
The window is a modal dialog with the ListView control on it.
I am using:
g_hImageLst = ImageList_Create(16,16,ILC_MASK | ILC_COLORDDB, 1, 0);
To setup my ImageList
I am using:
ListView_SetExtendedListViewStyle(hWnd,LVS_EX_SUBITEMIMAGES);
To setup the list view
Then:
SHGetFileInfo(dirInfo.cFileName,FILE_ATTRIBUTE_NORMAL, &shInfo, sizeof(shInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ICON | SHGFI_SMALLICON);
To Get The Files Icon
Finally:
ImageList_AddIcon(g_hImageLst, hIcon );
ListView_SetImageList(m_hWnd, g_hImageLst, LVSIL_SMALL)
To push the icons on the list and set the list.
Any suggestions on how to fix the icons so they look better?
-
-
After much searching and asking the question EVERYWHERE, I am closer to fixing this problem. I had to create a manifest file for the .exe.
Inside the file I put:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Test.exe"
type="win32"
/>
<description>Test</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Plus changed:
g_hImageLst = ImageList_Create(16,16,ILC_COLOR32, 1, 0);
ImageList_SetBkColor(g_hImageLst,CLR_NONE);
Now about 2/3s of the icons look correct. But there still are a few that are wrong, for example .rar.
Anyone know how to fix this?