问题
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