public static Icon ToIcon(
this Image image,
Color transparentColor
)<ExtensionAttribute>
Public Shared Function ToIcon (
image As Image,
transparentColor As Color
) As Iconpublic:
[ExtensionAttribute]
static Icon^ ToIcon(
Image^ image,
Color transparentColor
)[<ExtensionAttribute>]
static member ToIcon :
image : Image *
transparentColor : Color -> Icon The result icon will have the same size as the specified image. To force creating a squared icon, use the ToIcon(Image, Int32, Boolean) overload instead.
If the raw format of image is an icon that contains multiple images, then the result will also contain multiple resolutions.
To disable PNG compression also for large images regardless of the current operating system use the Combine(Bitmap, Color, Boolean) method instead.
This overload attempts to preserve the actual pixel format of the specified image, and just applies a transparency mask for the specified color. To allow reducing the color depth losslessly, use the ToIcon(Image) overload instead.
If transparentColor is an opaque color and image already has transparent pixels, then both the originally transparent pixels, and the ones that equal to transparentColor will be transparent in the result.
The result Icon is compatible with Windows XP if the method is executed in a Windows XP environment.