What causes the nation in the icon?
I am trying to set an icon for a window like this:
var bitmapImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"http://google.com/favicon.ico"));
this.Icon = bitmapImage;
However, when the icon is displayed, it shows a black border around it, as shown in the image below:
Can anyone point out where this plan came from and how I can prevent it?
Thanks in advance.
+3
source to share
1 answer
Tried it myself, this will make a border around the icon:
Icon = new BitmapImage(new Uri(@"pack://application:,,,/favicon.ico"));
and it won't:
Icon = new IconBitmapDecoder(new Uri(@"pack://application:,,,/favicon.ico"),
BitmapCreateOptions.None, BitmapCacheOption.Default).Frames[0];
So BitmapImage does some transformations that result in an opaque border.
+3
source to share
