得到文件的扩展名大图标 [英] Get large icon from file extension
问题描述
有几个地方是谈谈如何从一个文件扩展名的图标,如这之一,这等之一。几个小时与此类项目玩弄后,我已经成功地建立起这样的:
There are several places that talk about how to get an icon from a file extension such as this one and this other one. After several hours of playing around with this kind of projects I have managed to build something like:
private void addButton_Click(object sender, System.EventArgs e)
{
System.Drawing.Icon temp = IconReader.GetFileIcon(".cs", IconReader.IconSize.Large, false);
pictureBox1.Image = temp.ToBitmap();
}
这是按钮的执行得到我:
the execution of that button gets me:
但我想真正得到大图标。注意在Windows的图标怎么也更大:
but I am trying to actually get the large icon. Note how the icons on windows are much bigger:
我怎么能得到图标,而不是较小的一个。我花了这么多时间来修改其他程序。此外,我会想,使其与WPF工作,大部分的例子是有窗户的形式。我将不胜感激,如果我能得到如何提取一个文件图标,而不是修改和整个项目的例子。如果这是不可能的仍然将是非常有益的,我会很高兴。这只是我不是那么好程序员和我花了很多时间来修改其他例子。
How could I get that icon instead of the smaller one. I have spend so much time changing the other programs. Moreover I will like to make it work with wpf and most of the examples are with windows forms. I would appreciate if I can get an example of how to extract a files icon instead of modifying and entire project. If that is not possible that would still be very helpful and I will appreciate. It's just that I am not that good of a programmer and it took me a lot of time to modify the other examples.
推荐答案
这里有一个解决方案的 http://www.codeproject.com/KB/WPF/filetoiconconverter.aspx
here's a solution http://www.codeproject.com/KB/WPF/filetoiconconverter.aspx
这篇关于得到文件的扩展名大图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!