Icon Constructor (String, Int32, Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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)

new : 
        fileName:string *
        width:int *
        height:int -> Icon

Parameters

fileName
Type: System.String

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

width
Type: System.Int32

The desired width of the Icon.

height
Type: System.Int32

The desired height of the Icon.

Exception Condition
ArgumentException

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
Show: