c#获取文件图标

System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(str_ExePath);
System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
                                icon.Handle,
                                new Int32Rect(0, 0, icon.Width, icon.Height),
                                System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());

返回类型 System.Windows.Media.Imaging.BitmapSource

原文地址:https://www.cnblogs.com/RedSky/p/7081487.html