ImageExtensionsToIcon(Image, Int32, ScalingMode, Boolean) Method
Namespace: KGySoft.DrawingAssembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 8.1.0
public static Icon ToIcon(
this Image image,
int size,
ScalingMode scalingMode,
bool keepAspectRatio = true
)
<ExtensionAttribute>
Public Shared Function ToIcon (
image As Image,
size As Integer,
scalingMode As ScalingMode,
Optional keepAspectRatio As Boolean = true
) As Icon
public:
[ExtensionAttribute]
static Icon^ ToIcon(
Image^ image,
int size,
ScalingMode scalingMode,
bool keepAspectRatio = true
)
[<ExtensionAttribute>]
static member ToIcon :
image : Image *
size : int *
scalingMode : ScalingMode *
?keepAspectRatio : bool
(* Defaults:
let _keepAspectRatio = defaultArg keepAspectRatio true
*)
-> Icon
- image Image
- The image to be converted to an icon.
- size Int32
- The required width and height of the icon.
- scalingMode ScalingMode
- Specifies the scaling mode if size differs from the original size.
- keepAspectRatio Boolean (Optional)
- When source image is not square sized, determines whether the image should keep aspect ratio. This parameter is optional.
Default value: .
IconAn
Icon instance created from the
image.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).
The result icon will be always square sized and will contain only a single image.
To create a possibly non-squared icon, use the
ToIcon(Image, Color) overload or the
Icons.Combine method instead.