未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“Jayn.API.Jayn.resources”正确嵌入或链接到程序集“Jayn.API”,或者确保所有需要的附属程序集都可加载
创建一个资源文件
public class CreatResource { //System.Windows.Forms.Application.StartupPath+ private static string Skin_Path = Environment.CurrentDirectory + "\\Skin\\";//皮肤文件夹路径 /// <summary> /// 创建资源文件 /// </summary> public static bool Create() { if (!System.IO.File.Exists("Jayn.resources")) { ResourceWriter rw = new ResourceWriter("Jayn.resources");//创建一个资源文件 try { Image Top_Left = Image.FromFile(Skin_Path + "Top_Left.gif"); rw.AddResource("Top_Left.gif", Top_Left); rw.Generate(); rw.Close(); return true; } catch { rw.Close(); return false; throw new ArgumentException(Skin_Path); } } return true; } }
try { CResource = CreatResource.Create();创建一个资源文件 if(CResource) { rm = new ResourceManager("Jayn.API.Jayn", System.Reflection.Assembly.GetExecutingAssembly()); //读取图片 Top_Left = (Bitmap)rm.GetObject("Top_Left.gif"); } } catch (Exception e) { throw new ArgumentException(e.Message); }