有没有简单的方法可以将ImageSource转换为Icon?我的用例:我将Window.Icon
属性(类型为System.Windows.Media.ImageSource
)用作NotifyIcon.Icon
(即System.Drawing.Icon
)的相同图标,如下所示:>
// ...
this.notifyIcon = new System.Windows.Forms.NotifyIcon()
{
Icon = ConvertToIcon(this.Icon),
};
// ...
public System.Drawing.Icon ConvertToIcon(ImageSource imageSource)
{
// Implementation?
}
任何内置或简单的方法可以做到这一点?