ExtractIcon 导出系统图标
ExtractIcon 导出系统图标 /// /// 依据文件名读取图标,若指定文件不存在,则返回空值。 /// /// 文件路径 /// 是否返回大图标 /// public static Icon GetIconByFileName(string fileName, bool isLarge = true) { int[] phiconLarge = new int[1]; int[] phiconSmall = new int[1]; //文件名 图标索引 Win32.ExtractIc onEx(fileName, 0, phiconLarge, phiconSmall, 1); IntPtr IconHnd = new IntPtr(isLarge ? phiconLarge[0] : phiconSmall[0]); return Icon.FromHandle(IconHnd); } onEx(fileName, 0, phiconLarge, phiconSmall, 1); IntPtr IconHnd = new IntPtr(isLarge ? phiconLarge[0] : phiconSmall[0]); return Icon.FromHandle(IconHnd); }
用户评论