ערוך

שתף באמצעות


Icon.ExtractIcon Method

Definition

Overloads

ExtractIcon(String, Int32, Boolean)

Extracts a specified icon from the given filePath.

ExtractIcon(String, Int32, Int32)

Extracts a specified icon from the given filePath.

ExtractIcon(String, Int32, Boolean)

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

Extracts a specified icon from the given 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

Parameters

filePath
String

Path to an icon or PE (.dll, .exe) file.

id
Int32

Positive numbers refer to an icon index in the given file. Negative numbers refer to a specific native resource identifier in a PE (.dll, .exe) file.

smallIcon
Boolean

true to get the Icon at the current system small icon size setting. false to get the Icon at the current system large icon size setting. The default is false.

Returns

An Icon, or null if an icon can't be found with the specified id.

Applies to

ExtractIcon(String, Int32, Int32)

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

Extracts a specified icon from the given 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

Parameters

filePath
String

Path to an icon or PE (.dll, .exe) file.

id
Int32

Positive numbers refer to an icon index in the given file. Negative numbers refer to a specific native resource identifier in a PE (.dll, .exe) file.

size
Int32

The desired size. If the specified size does not exist, an existing size will be resampled to give the requested size.

Returns

An Icon, or null if an icon can't be found with the specified id.

Exceptions

size is negative or larger than MaxValue.

filePath could not be accessed.

filePath is null.

Remarks

Unlike the Icon, this method and the ExtractAssociatedIcon(String) methods do not retain all of the resource data or modify the original data (outside of resizing if necessary). As such, the Icon only uses as much memory as is needed for the requested size (mostly native memory).

Without the original source data, the Icon have to resample the current icon's bitmap to change sizes. For best image quality, if different sizes for an Icon are desired you should create separate instances with this method and avoid the copy constructors.

Applies to