3

如何检索与文件/文件夹关联的系统图标,以便可以在与文件/文件夹名称相邻的列表视图中显示它?

4

2 回答 2

4

You need to use Icon.ExtractAssociatedIcon

 Icon icon = Icon.ExtractAssociatedIcon(filepath);

Take a look at Icon.ExtractAssociatedIcon documentation

Note: this works only for files. For folders you need P/Invoke sample is here Edit: Page is now defunct, please refer to this copy on the Wayback Machine.

于 2013-08-26T12:32:08.250 回答
0

See Obtaining (and managing) file and folder icons using SHGetFileInfo in C#.

于 2013-08-26T12:31:14.630 回答