Beispiel #1
0
        private static BitmapImage IconToBitmapImage(System.Drawing.Icon ico)
        {
            MemoryStream ms = new MemoryStream();
            ico.ToBitmap().Save(ms, System.Drawing.Imaging.ImageFormat.Png);

            BitmapImage bImg = new System.Windows.Media.Imaging.BitmapImage();

            bImg.BeginInit();

            bImg.StreamSource = new MemoryStream(ms.ToArray());
            bImg.EndInit();

            ms.Close();

            return bImg;
        }
 public ToolStripButton makeButton(string toolTipText, System.Drawing.Icon icon, EventHandler onClick)
 {
     Image image = Image.FromHbitmap(icon.ToBitmap().GetHbitmap());
     return makeButton(toolTipText, image, onClick);
 }
Beispiel #3
0
        /// <summary>Save a Windows icon to cache</summary>
        /// <param name="sdi">The System.Drawing.Icon, which needs to be saved</param>
        /// <param name="name">The icon name</param>
        /// <param name="size">The icon size</param>
        public static void SaveIconToCache(System.Drawing.Icon sdi, string name, int size = 16)
        {
            if (!Directory.Exists(PathToIcons + Path.DirectorySeparatorChar + size))
            {
                Directory.CreateDirectory(PathToIcons + Path.DirectorySeparatorChar + size);
            }

            string IconPath = PathToIcons + Path.DirectorySeparatorChar + size + Path.DirectorySeparatorChar + name + ".png";
            sdi.ToBitmap().Save(IconPath);
        }
 internal Icon(System.Drawing.Icon icon)
 {
     this.hicon = icon.ToBitmap().GetHicon();
 }
Beispiel #5
0
 public static stdole.IPictureDisp IconToPictureDisp(System.Drawing.Icon icon)
 {
     return ImageToPictureDisp(icon.ToBitmap());
 }
 public static Gdk.Pixbuf Bitmap2Pixbuf(System.Drawing.Icon icon)
 {
     return Bitmap2Pixbuf(icon.ToBitmap());
 }