public static Icon GetIcon(this EmbeddedResourceManager manager, string resourceKey, int width, int height) { if (width == -1) { return(new Icon(manager.GetStream(resourceKey))); } else { return(new Icon(manager.GetStream(resourceKey), width, height)); } }
public static Image GetImage(this EmbeddedResourceManager manager, string resourceKey) { return(Image.FromStream(manager.GetStream(resourceKey))); }
//public static System.Windows.Media.ImageSource GetResourceAsImageSource(this GoldenLibrary.ResourceManagerBase manager, string resourceKey) //{ // var assemblyName = Assembly.GetAssembly(manager.GetType()).GetName().Name; // var uri = new Uri(string.Concat(@"pack://application:,,,/", assemblyName, ";component/Resources/", resourceKey), UriKind.RelativeOrAbsolute); // return new BitmapImage(uri); //} public static ImageSource GetImageSource(this EmbeddedResourceManager manager, string resourceKey) { var stream = manager.GetStream(resourceKey); return(Win.Utility.WPFUtilities.StreamToImageSource(stream)); }