Icon Constructor (Icon^, Int32, Int32)
.NET Framework (current version)
Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size.
Assembly: System.Drawing (in System.Drawing.dll)
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.
| Exception | Condition |
|---|---|
| ArgumentException | The original parameter is null. |
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.
private: void IconToBitmap( PaintEventArgs^ e ) { // Construct an Icon. System::Drawing::Icon^ icon1 = gcnew System::Drawing::Icon( SystemIcons::Exclamation,40,40 ); // Call ToBitmap to convert it. Bitmap^ bmp = icon1->ToBitmap(); // Draw the bitmap. e->Graphics->DrawImage( bmp, Point(30,30) ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: