Icon Constructor (String, Int32, Int32)


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)

Public Sub New (
	fileName As String,
	width As Integer,
	height As Integer


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