我的资源文件中有一个图标,我想引用它。
这是需要图标文件路径的代码:
IWshRuntimeLibrary.IWshShortcut MyShortcut ;
MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\PerfectUpload.lnk");
MyShortcut.IconLocation = //path to icons path . Works if set to @"c:/icon.ico"
我不想使用外部图标文件,而是希望它找到一个嵌入式图标文件。 有点像
MyShortcut.IconLocation = Path.GetFullPath(global::perfectupload.Properties.Resources.finish_perfect1.ToString()) ;
这可能吗?如果是怎么办?
谢谢
最佳答案
我认为这应该可行,但我记不清了(不是在工作中仔细检查)。
MyShortcut.IconLocation = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("YourNamespace.IconFilename.ico");
关于c# - 嵌入式资源文件的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5283313/