标签:style blog http color io ar art div log
首先在工程添加对System.Drawing的引用
创建以下方法:
public static ImageSource GetIcon(string fileName) { System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(fileName); return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( icon.Handle, new Int32Rect(0,0,icon.Width, icon.Height), BitmapSizeOptions.FromEmptyOptions()); }
在WPF窗体添加一个Image控件
就可以调用了:
this.image1.Source=GetIcon("C:\\test.exe");
转自:http://blog.csdn.net/soft2buy/article/details/6979351
标签:style blog http color io ar art div log
原文地址:http://www.cnblogs.com/gebenhagen/p/3949312.html