/// <summary> /// 从Image获得图像资源 /// </summary> /// <param name="image"></param> /// <returns></returns> public static ImageResource FromImage(Image image) { if (image == null) { throw new ArgumentNullException("image"); } ImageResource resource = new ImageResource(image); return(resource); }
/// <summary> /// 从各种途径获得Image。优先级为 当前目录下文件->程序资源项目->Feng资源项目 /// </summary> /// <param name="fileName"></param> /// <returns></returns> public static Image TryGet(string fileName) { if (System.IO.File.Exists(fileName)) { return(new System.Drawing.Bitmap(fileName)); } else { System.Drawing.Image image = ImageResource.Get(fileName).Reference; if (image != null) { return(image); } else { return(ImageResource.Get("Feng", fileName).Reference); } } }