我怎么可以转换System.Drawing.Icon到System.Drawing.Image对象? [英] how can I convert System.Drawing.Icon to System.Drawing.Image?

查看:1074
本文介绍了我怎么可以转换System.Drawing.Icon到System.Drawing.Image对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从另一个应用程序使用此获得的图标:

I'm getting icon from another application using this:

Icon IEIcon =  Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");

如何将其转化为 System.Drawing.Image对象

在此先感谢。

推荐答案

位图图片来源所以你可以用图标的 .ToBitmap() 方法。

Description

The Bitmap is derived from Image so you can use Icon's .ToBitmap() method.

Icon IEIcon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = IEIcon.ToBitmap();

更多信息

  • MSDN - Bitmap类
  • MSDN - 图片类
  • More Information

    • MSDN - Bitmap Class
    • MSDN - Image Class
    • 这篇关于我怎么可以转换System.Drawing.Icon到System.Drawing.Image对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆