How can I convert BitmapImage to Icon?

跟風遠走 提交于 2019-12-10 18:49:31

问题


In my application I have to send a List<MenuItem> to my shell extension in WCF. These MenuItems are composed of an icon and a label. The type of the icon is System.Drawing.Icon but I have to work from System.Windows.Media.Imaging.BitmapImage. Is there a way to convert BitmapImage to Icon ?


回答1:


My thoughts:

First comvert BitmapImage to Bitmap

Converting BitmapImage to Bitmap and vice versa

then save as Icon

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/4a10d440-707f-48d7-865b-1d8804faf649/

Hope this helps!




回答2:


Haven’t created icons myself this way but perhaps you could benefit from going from Graphics to Icon. Then you can select interpolation mode (which perhaps could be nice). See an example here: http://www.dreamincode.net/code/snippet1684.htm



来源:https://stackoverflow.com/questions/11247516/how-can-i-convert-bitmapimage-to-icon

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!