IconExtensionsCombine(Icon, Bitmap, Color) Method

Combines an Icon instance with the provided image into a multi-resolution Icon instance.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 10.1.0
C#
public static Icon Combine(
	this Icon icon,
	Bitmap? image,
	Color transparentColor
)

Parameters

icon  Icon
The icon to combine with other images.
image  Bitmap
The image to be added to the icon. Can be a non-squared one.
transparentColor  Color
A color that represents the transparent color in image.

Return Value

Icon
An Icon instance that contains the source image.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Icon. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

Both icon and image may contain multiple icons.

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 Combine(Icon, Bitmap) 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.

See Also