Can you convert a System.Windows.Control.Image to a System.Drawing.Icon?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The title of the question pretty much states the problem. Is it possible? 回答1: As an alternative, I've used the hints found here : public static Icon Convert(BitmapImage bitmapImage) { var ms = new MemoryStream(); var encoder = new PngBitmapEncoder(); // With this we also respect transparency. encoder.Frames.Add(BitmapFrame.Create(bitmapImage)); encoder.Save(ms); var bmp = new Bitmap(ms); return Icon.FromHandle(bmp.GetHicon()); } 回答2: I modified an example from here . This seems to work pretty good. public static Icon Convert(BitmapImage