Icon Constructor (String, Int32, Int32)


Initializes a new instance of the Icon class with the specified width and height from the specified file.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public Icon(
	string fileName,
	int width,
	int height


Type: System.String

The name and path to the file that contains the Icon data.

Type: System.Int32

The desired width of the Icon.

Type: System.Int32

The desired height of the Icon.

Exception Condition

The string is null or does not contain image data.

If the specified file does not contain an image that matches the desired height and width, the icon that has the closest size is returned.

The fileName should include the complete path if it is not in the current application directory.

.NET Framework
Available since 2.0
Return to top