Click or drag to resize

IconUtilitiesGetPreferredSizeBitmap Method

Gets the closest bitmap that matches a given size from a list of bitmaps. At least one of preferredWidth or preferredHeight values must be defined.

Namespace:  ShellBoost.Core.Utilities
Assembly:  ShellBoost.Core (in ShellBoost.Core.dll) Version: 1.8.3.0
Syntax
C#
public static Bitmap GetPreferredSizeBitmap(
	this IEnumerable<Bitmap> bitmaps,
	int? preferredWidth = null,
	int? preferredHeight = null,
	bool exactMatch = false,
	bool disposeOthers = true
)

Parameters

bitmaps
Type: System.Collections.GenericIEnumerableBitmap
The list of bitmaps.
preferredWidth (Optional)
Type: SystemNullableInt32
The preferred bitmap width.
preferredHeight (Optional)
Type: SystemNullableInt32
The preferred bitmap height.
exactMatch (Optional)
Type: SystemBoolean
if set to true only a bitmap that exactly matches the preffered size will be returned.
disposeOthers (Optional)
Type: SystemBoolean
if set to true other bitmaps are disposed.

Return Value

Type: Bitmap
A Bitmap instance or null if the list contains nothing.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableBitmap. 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).
Exceptions
ExceptionCondition
ArgumentExceptionnull - preferredWidth
See Also