Exemplo n.º 1
0
        public static void SetPicture(Assembly assembly, _CommandBarButton button, string resource, string masked)
        {
            using (Stream imageStream = assembly.GetManifestResourceStream(resource))
            {
                button.Picture = (StdPicture)PictureHost.IPictureDisp(Image.FromStream(imageStream));
#if !NET_4_0
                using (Stream imageStreamMask = assembly.GetManifestResourceStream(masked))
                {
                    button.Mask = (StdPicture)PictureHost.IPictureDisp(Image.FromStream(imageStreamMask));
                }
#endif
            }
        }
Exemplo n.º 2
0
 public static StdPicture GetResourceImage(string key)
 {
     try
     {
         using (Stream imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(key))
         {
             return((StdPicture)PictureHost.IPictureDisp(Image.FromStream(imageStream)));
         }
     }
     catch
     {
         return(null);
     }
 }