语言

Icon.ExtractIcon 方法

定义

重载

名称 说明
ExtractIcon(String, Int32, Boolean)

从给定 filePath的中提取指定的图标。

ExtractIcon(String, Int32, Int32)

从给定 filePath的中提取指定的图标。

ExtractIcon(String, Int32, Boolean)

Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs

从给定 filePath的中提取指定的图标。

public static System.Drawing.Icon? ExtractIcon(string filePath, int id, bool smallIcon = false);
static member ExtractIcon : string * int * bool -> System.Drawing.Icon
Public Shared Function ExtractIcon (filePath As String, id As Integer, Optional smallIcon As Boolean = false) As Icon

参数

filePath
String

图标或 PE 的路径(.dll,.exe) 文件。

id
Int32

正数是指给定文件中的图标索引。 负数是指 PE (.dll, .exe) 文件中的特定本机资源标识符。

smallIcon
Boolean

true Icon获取当前系统较小的图标大小设置。 false Icon获取当前系统大型图标大小设置。 默认值为 false。

返回

一个 Icon,或者 null 如果找不到具有指定 id图标的图标。

适用于

ExtractIcon(String, Int32, Int32)

Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs
Source:
Icon.cs

从给定 filePath的中提取指定的图标。

public:
 static System::Drawing::Icon ^ ExtractIcon(System::String ^ filePath, int id, int size);
public static System.Drawing.Icon? ExtractIcon(string filePath, int id, int size);
static member ExtractIcon : string * int * int -> System.Drawing.Icon
Public Shared Function ExtractIcon (filePath As String, id As Integer, size As Integer) As Icon

参数

filePath
String

图标或 PE 的路径(.dll,.exe) 文件。

id
Int32

正数是指给定文件中的图标索引。 负数是指 PE (.dll, .exe) 文件中的特定本机资源标识符。

size
Int32

所需大小。 如果指定的大小不存在,将重新采样现有大小,以便提供所请求的大小。

返回

一个 Icon,或者 null 如果找不到具有指定 id图标的图标。

例外

size 为负数或大于 MaxValue。

filePath 无法访问。

filePath 是 null。

注解

Icon与此方法不同,此方法和ExtractAssociatedIcon(String)方法不会保留所有资源数据或修改原始数据(如有必要,超出大小调整)。 因此, Icon 请求的大小(主要是本机内存)仅使用所需的内存量。

如果没有原始源数据, Icon 必须重新采样当前图标的位图以更改大小。 为了获得最佳图像质量,如果需要不同的大小 Icon ,则应使用此方法创建单独的实例,并避免复制构造函数。

适用于