Fixed: icon transparency fault

This commit is contained in:
Ray 2021-09-28 18:08:53 +01:00
parent 4c031108f0
commit 2af53adcae
4 changed files with 13 additions and 43 deletions

View File

@ -322,7 +322,6 @@ namespace FizzyLauncher
}; };
} }
protected bool IsBusy protected bool IsBusy
{ {
get => isBusy; get => isBusy;
@ -388,7 +387,7 @@ namespace FizzyLauncher
}); });
} }
private Image RetrieveImage(string url) private Bitmap RetrieveImage(string url)
{ {
if (string.IsNullOrWhiteSpace(url)) if (string.IsNullOrWhiteSpace(url))
{ {
@ -408,6 +407,7 @@ namespace FizzyLauncher
} }
Image img = Image.FromStream(new MemoryStream(byteData)); Image img = Image.FromStream(new MemoryStream(byteData));
return new Bitmap(img, 16, 16); return new Bitmap(img, 16, 16);
} }
catch (Exception) catch (Exception)

View File

@ -3,7 +3,6 @@ using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Windows.Forms;
namespace BookmarkManager namespace BookmarkManager
{ {
@ -96,7 +95,6 @@ namespace BookmarkManager
return true; return true;
} }
public Image FindIcon(string id) public Image FindIcon(string id)
{ {
if (dbConnection == null) return null; if (dbConnection == null) return null;
@ -148,7 +146,8 @@ namespace BookmarkManager
return null; return null;
} }
return new Bitmap(img, 16, 16); return img;
//return new Bitmap(img, 16, 16);
} }
public bool HasIcon(string id) public bool HasIcon(string id)
@ -236,11 +235,14 @@ namespace BookmarkManager
protected byte[] ImageToBytes(Image image) protected byte[] ImageToBytes(Image image)
{ {
MemoryStream stream = new MemoryStream(); //MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Bmp); //image.Save(stream, image.RawFormat);
stream.Close(); //stream.Close();
return stream.ToArray(); //return stream.ToArray();
ImageConverter imageConverter = new ImageConverter();
return (byte[])imageConverter.ConvertTo(image, typeof(byte[]));
} }
} }

View File

@ -687,19 +687,6 @@ namespace FizzyLauncher
if (nodeType == BookmarkTreeView.NodeType.Page) if (nodeType == BookmarkTreeView.NodeType.Page)
{ {
UpdateBookmarkNode(false); UpdateBookmarkNode(false);
//BookmarkForm bookmarkForm = new BookmarkForm(treeView1.GetNodeModel(), null);
//if (bookmarkForm.ShowDialog() == DialogResult.OK)
//{
// UpdateBookmarkNode(bookmarkForm);
// //string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName);
// //if (!string.IsNullOrWhiteSpace(iconID))
// //{
// // iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon);
// //}
// //treeView1.UpdateItem(treeView1.SelectedNode, bookmarkForm.Model.Item);
//}
} }
break; break;
@ -724,24 +711,6 @@ namespace FizzyLauncher
treeView1.SelectedNode = node; treeView1.SelectedNode = node;
UpdateBookmarkNode(true); UpdateBookmarkNode(true);
//BookmarkForm bookmarkForm = new BookmarkForm(treeView1.GetNodeModel(), null);
//if (bookmarkForm.ShowDialog() == DialogResult.OK)
//{
// UpdateBookmarkNode(bookmarkForm);
// //string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName);
// //if (!string.IsNullOrWhiteSpace(iconID))
// //{
// // iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon);
// //}
// //treeView1.UpdateItem(treeView1.SelectedNode, bookmarkForm.Model.Item);
//}
//else
//{
// node.Remove();
//}
} }
break; break;
@ -1104,7 +1073,7 @@ namespace FizzyLauncher
string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName); string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName);
if (!string.IsNullOrWhiteSpace(iconID)) if (!string.IsNullOrWhiteSpace(iconID))
{ {
iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon); iconDatabase.AddIcon(iconID, icon);
} }
treeView1.UpdateItem(treeView1.SelectedNode, bookmarkForm.Model.Item); treeView1.UpdateItem(treeView1.SelectedNode, bookmarkForm.Model.Item);

View File

@ -227,7 +227,7 @@ namespace RyzStudio.Windows.Forms
this.SelectedImageIndex = 0; this.SelectedImageIndex = 0;
this.ShowNodeToolTips = true; this.ShowNodeToolTips = true;
this.ImageList.ColorDepth = ColorDepth.Depth16Bit; this.ImageList.ColorDepth = ColorDepth.Depth32Bit;
this.ImageList.ImageSize = new Size(16, 16); this.ImageList.ImageSize = new Size(16, 16);
this.ImageList.TransparentColor = Color.Transparent; this.ImageList.TransparentColor = Color.Transparent;
this.ImageList.Images.Clear(); this.ImageList.Images.Clear();
@ -235,7 +235,6 @@ namespace RyzStudio.Windows.Forms
this.ImageList.Images.Add(Resources.folder); this.ImageList.Images.Add(Resources.folder);
this.ImageList.Images.Add(Resources.folder_explore); this.ImageList.Images.Add(Resources.folder_explore);
this.ImageList.Images.Add(Resources.file_text); this.ImageList.Images.Add(Resources.file_text);
} }