vb.net - Items icons with listview and imagelist -
vb.net - Items icons with listview and imagelist -
hello i've got list view opens items within folder , displays them. want know if there way have list view display icons aswell, maybe using shell32 or imagelist. here's code:
imports system.io imports system.xml imports system.runtime.interopservices imports microsoft.visualbasic public class cv7import private sub cv7import_load(byval sender system.object, byval e system.eventargs) handles mybase.load dim caminho string caminho = "c:\documents , settings\software\ambiente de trabalho\1" lstvicon.view = view.details lstvicon.gridlines = false lstvicon.fullrowselect = true lstvicon.hideselection = false lstvicon.multiselect = true lstvicon.columns.add("nome") lstvicon.autoresizecolumns(columnheaderautoresizestyle.headersize) dim di system.io.directoryinfo = new system.io.directoryinfo(caminho) dim files() system.io.fileinfo = di.getfiles dim file system.io.fileinfo dim li listviewitem each file in files li = lstvicon.items.add(file.name) li.tag = file.fullname next end sub end class
here's 2 images, of how looks , how want look, if helps.
how wanted: http://imageshack.us/photo/my-images/21/wantd.png/
how looks: http://imageshack.us/photo/my-images/13/needk.png/
well need find extension of file start with:
dim file string = "c:\scratch\newfile.txt" dim ext string = io.path.getextension(file)
then need find entry in hkey_classes_root
section of registry:
hkey_classes_root\.txt
the default value in key gives file type associated file in case txtfile
(remember different registries may have different values depending on user has set , programs installed)
you need values defaulticon
key in hkey_classes_root
:
hkey_classes_root\txtfile\defaulticon
the default value in here gives location of icon , icon number in case:
%systemroot%\system32\imageres.dll,-102
from point think may need rely on extracticonex api extract icon. this link may of use
vb.net listview imagelist
Comments
Post a Comment