IconExtensions.ToAlphaBitmap Method

KGy SOFT Drawing Libraries

IconExtensionsToAlphaBitmap Method KGy SOFT Drawing Libraries Help
Converts the specified icon to a Bitmap. While Icon.ToBitmap may return a wrong result when icon contains semi-transparent pixels, this method returns an image, in which alpha channel is always correctly applied for the image.

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 4.6.1
Syntax

public static Bitmap ToAlphaBitmap(
	this Icon icon
)
<ExtensionAttribute>
Public Shared Function ToAlphaBitmap ( 
	icon As Icon
) As Bitmap
public:
[ExtensionAttribute]
static Bitmap^ ToAlphaBitmap(
	Icon^ icon
)
[<ExtensionAttribute>]
static member ToAlphaBitmap : 
        icon : Icon -> Bitmap 

Parameters

icon
Type: System.DrawingIcon
The icon optionally with transparency.

Return Value

Type: Bitmap
A Bitmap that represents the converted Icon.

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

ExtractBitmap and ToAlphaBitmap(Icon) methods may return a different result even if the icon contains a single image only. The ExtractBitmap overloads works from the saved icon stream in the first place, which is slower than this method.

If the icon contains multiple images consider to use either the ExtractBitmap overloads to specify the exact image to return, or the ToMultiResBitmap method, which returns every images in a single combined Bitmap.

See Also

Reference