예제 #1
0
 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));
     }
 }
예제 #2
0
 public static Image GetImage(this EmbeddedResourceManager manager, string resourceKey)
 {
     return(Image.FromStream(manager.GetStream(resourceKey)));
 }
예제 #3
0
        //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));
        }