Export (0) Print
Expand All

Icon Constructor (Icon, Int32, Int32)

Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size.

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

new : 
        original:Icon * 
        width:int * 
        height:int -> Icon

Parameters

original
Type: System.Drawing.Icon

The icon to load the different size from.

width
Type: System.Int32

The width of the new icon.

height
Type: System.Int32

The height of the new icon.

ExceptionCondition
ArgumentException

The original parameter is a null reference (Nothing in Visual Basic).

If a version cannot be found that exactly matches the size, the closest match is used. If the original parameter is an Icon that has a single size, this method only creates a duplicate icon. Use the stretching capabilities of the DrawImage method to resize the icon.

The following code example demonstrates how to use the ToBitmap method. This example is designed to be used with Windows Forms. Create a form and paste the following code into it. Call the IconToBitmap method in the form's Paint event handler, passing e as PaintEventArgs.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft