public final class Icon extends Object implements com.aspose.ms.System.ICloneable, com.aspose.ms.System.IDisposable
Represents a Windows icon, which is a small bitmap image that is used to represent an object. Icons can be thought of as transparent bitmaps, although their size is determined by the system.
ICloneable,
IDisposable| Constructor and Description |
|---|
Icon(Icon original,
int width,
int height)
Initializes a new instance of the
Icon class and attempts to find a version of the icon that matches the requested size.. |
Icon(Icon original,
Size size)
Initializes a new instance of the
Icon class and attempts to find a version of the icon that matches the requested size. |
Icon(InputStream stream)
Initializes a new instance of the
Icon class from the specified data stream. |
Icon(InputStream stream,
int width,
int height)
Initializes a new instance of the
Icon class from the specified data stream and with the specified width and height. |
Icon(InputStream stream,
Size size)
Initializes a new instance of the
Icon class of the specified size from the specified stream. |
Icon(Object type,
String resource)
Initializes a new instance of the
Icon class from a resource in the specified assembly. |
Icon(String fileName)
Initializes a new instance of the
Icon class from the specified file name. |
Icon(String fileName,
int width,
int height)
Initializes a new instance of the
Icon class with the specified width and height from the specified file. |
Icon(String fileName,
Size size)
Initializes a new instance of the
Icon class of the specified size from the specified file. |
| Modifier and Type | Method and Description |
|---|---|
Object |
deepClone()
Clones the
Icon, creating a duplicate image. |
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
static Icon |
extractAssociatedIcon(String filePath)
Returns an icon representation of an image that is contained in the specified file.
|
static Icon |
fromHandle(byte[] handle)
Creates a GDI+
Icon from the specified Windows handle to an icon (HICON). |
com.aspose.ms.System.IntPtr |
getHandle()
Gets the handle for this
Icon. |
int |
getHeight()
Gets the height of this
Icon. |
Size |
getSize()
Gets the size of this
Icon. |
int |
getWidth()
Gets the width of this
Icon. |
void |
save(OutputStream outputStream)
Saves this
Icon to the specified output InputStream. |
Bitmap |
toBitmap()
|
String |
toString()
Gets a human-readable string that describes the
Icon. |
public Icon(String fileName)
Initializes a new instance of the Icon class from the specified file name.
fileName - The file to load the Icon from.public Icon(InputStream stream)
Initializes a new instance of the Icon class from the specified data stream.
stream - The data stream from which to load the Icon.public Icon(String fileName, Size size)
Initializes a new instance of the Icon class of the specified size from the specified file.
fileName - The name and path to the file that contains the icon data.size - The desired size of the icon.public Icon(Icon original, Size size)
Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size.
original - The Icon from which to load the newly sized icon.size - A Size(Icon.getSize()) structure that specifies the height and width of the new Icon.public Icon(Object type, String resource)
Initializes a new instance of the Icon class from a resource in the specified assembly.
type - A Type that specifies the assembly in which to look for the resource.resource - The resource name to load.public Icon(InputStream stream, Size size)
Initializes a new instance of the Icon class of the specified size from the specified stream.
stream - The stream that contains the icon data.size - The desired size of the icon.public Icon(String fileName, int width, int height)
Initializes a new instance of the Icon class with the specified width and height from the specified file.
public Icon(Icon original, int width, int height)
Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size..
original - The icon to load the different size from.width - The width of the new icon.height - The height of the new icon.public Icon(InputStream stream, int width, int height)
Initializes a new instance of the Icon class from the specified data stream and with the specified width and height.
stream - The data stream from which to load the icon.width - The width, in pixels, of the icon.height - The height, in pixels, of the icon.public com.aspose.ms.System.IntPtr getHandle()
Gets the handle for this Icon. This is not a copy of the handle; do not free it.
public int getHeight()
public Size getSize()
Gets the size of this Icon.
Size(Icon.getSize()) structure that specifies the width and height of this Icon.public int getWidth()
public static Icon extractAssociatedIcon(String filePath)
Returns an icon representation of an image that is contained in the specified file.
filePath - The path to the file that contains an image.Icon representation of the image that is contained in the specified file.public static Icon fromHandle(byte[] handle)
Creates a GDI+ Icon from the specified Windows handle to an icon (HICON).
handle - A Windows handle to an icon.Icon this method creates.public Object deepClone()
Clones the Icon, creating a duplicate image.
deepClone in interface com.aspose.ms.System.ICloneableIcon.public void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
dispose in interface com.aspose.ms.System.IDisposablepublic void save(OutputStream outputStream)
Saves this Icon to the specified output InputStream.
outputStream - The InputStream to save to.Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.