开发者

display icon with respective file

开发者 https://www.devze.com 2022-12-16 00:23 出处:网络
Ok this is something new to me.... I have a gridview control which is displaying the files and directory names in one column.

Ok this is something new to me....

I have a gridview control which is displaying the files and directory names in one column.

Now i want to display the file icon of that particular file in the other column...

eg test.txt will have a different icon form image1.jpg and here.xsl

i have found two examples but don't kno if they will work or not....

http://www.codeproject.com/KB/custom-controls/AssociatedIconsImage.aspx

or

http://forums.asp.net/t/90921.aspx

how to in开发者_Python百科corporate this with my gridview..?

thanks


I found a source that should be useful for you (and with a simple google query btw.): Getting Associated Icons Using C# .

As far as I know, there's no other way than using the shell32 library via interop, as used in the given example.


I'm not sure if there is a managed way to this... there very well could be, but the unmanaged way to get this would be to use PInvoke to call SHGetFileInfo. There is sample code on PInvoke.Net which should get you most of the way there.

0

精彩评论

暂无评论...
验证码 换一张
取 消