ImageExtensions.ToIcon Method

KGy SOFT Drawing Libraries

ImageExtensionsToIcon Method KGy SOFT Drawing Libraries Help
Creates an Icon from an Image.

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

public static Icon ToIcon(
	this Image image,
	int size,
	bool keepAspectRatio
)
<ExtensionAttribute>
Public Shared Function ToIcon ( 
	image As Image,
	size As Integer,
	keepAspectRatio As Boolean
) As Icon
public:
[ExtensionAttribute]
static Icon^ ToIcon(
	Image^ image, 
	int size, 
	bool keepAspectRatio
)
[<ExtensionAttribute>]
static member ToIcon : 
        image : Image * 
        size : int * 
        keepAspectRatio : bool -> Icon 

Parameters

image
Type: System.DrawingImage
The image to be converted to an icon.
size
Type: SystemInt32
The required size of the icon.
keepAspectRatio
Type: SystemBoolean
When source image is not square sized, determines whether the image should keep aspect ratio.

Return Value

Type: Icon
An Icon instance created from the image.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Image. 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

The result icon will be always square sized. To create a non-squared icon, use the Icons.Combine method instead.
See Also

Reference