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

posted @ 2017-06-26 17:19  HotSky  阅读(1220)  评论(0编辑  收藏  举报