IconsFromFile(String, SystemIconSize) Method

Extracts icons of the specified size from a file and returns them as separated Icon instances.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 10.0.0-rc.1
C#
public static Icon[] FromFile(
	string fileName,
	SystemIconSize size
)

Parameters

fileName  String
The name of the file. Can be an executable file, a .dll or icon file.
size  SystemIconSize
The size of the icons to be extracted.

Return Value

Icon
The icons of the specified file, or an empty array if the file does not exist or does not contain any icons.

Remarks

The actual resolution represented by size depends on the DPI of the main display. To retrieve all actual icon images use the FromFile(String) overload instead, and then you can extract the exact resolution by the IconExtensions.ExtractIcon extension method.

If fileName refers to an icon file use the Icon(String) constructor instead.

The images of an Icon can be extracted by the IconExtensions.ExtractBitmaps methods.

  Note

On non-Windows platforms this method always returns an empty array.

See Also