Class Icon
Represents a Windows icon (.ico) as a managed Bitmap. Loading is performed by DRIT.Drawing.Codecs.IcoCodec; saving writes a single-frame PNG-compressed ICO container.
Implements
Inherited Members
Namespace: DRIT.Drawing.Imaging
Assembly: DRIT.Drawing.dll
Syntax
public sealed class Icon : IDisposable
Constructors
Icon(Icon, Size)
Initializes a new Icon as a copy of the specified icon with the specified size.
Declaration
public Icon(Icon original, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Icon | original | The original icon to copy. |
| Size | size | The size of the new icon. |
Icon(Icon, int, int)
Initializes a new Icon as a copy of the specified icon with the specified dimensions.
Declaration
public Icon(Icon original, int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| Icon | original | The original icon to copy. |
| int | width | The width of the new icon. |
| int | height | The height of the new icon. |
Icon(Stream)
Initializes a new Icon from the specified stream.
Declaration
public Icon(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing icon data. |
Icon(string)
Initializes a new Icon from the specified file.
Declaration
public Icon(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The path to the icon file. |
Properties
Height
Gets the height of the icon.
Declaration
public int Height { get; }
Property Value
| Type | Description |
|---|---|
| int |
Size
Gets the size of the icon.
Declaration
public Size Size { get; }
Property Value
| Type | Description |
|---|---|
| Size |
Width
Gets the width of the icon.
Declaration
public int Width { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Dispose()
Releases all resources used by this Icon.
Declaration
public void Dispose()
ExtractAssociatedIcon(string)
Returns null; OS-level association lookup is not available.
Declaration
public static Icon? ExtractAssociatedIcon(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath |
Returns
| Type | Description |
|---|---|
| Icon |
FromHandle(IntPtr)
Not supported on this platform.
Declaration
public static Icon FromHandle(IntPtr handle)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | handle |
Returns
| Type | Description |
|---|---|
| Icon |
Save(Stream)
Writes this icon to outputStream as a single-frame
PNG-compressed ICO container.
Declaration
public void Save(Stream outputStream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | outputStream |
ToBitmap()
Returns a new Bitmap copied from this icon's pixels.
Declaration
public Bitmap ToBitmap()
Returns
| Type | Description |
|---|---|
| Bitmap |