BitmapSizeOptions.FromWidthAndHeight Method (Int32, Int32)


Initializes an instance of BitmapSizeOptions that does not preserve the original bitmap aspect ratio.

Namespace:   System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)

public static BitmapSizeOptions FromWidthAndHeight(
	int pixelWidth,
	int pixelHeight


Type: System.Int32

The width, in pixels, of the resulting bitmap.

Type: System.Int32

The height, in pixels, of the resulting bitmap.

Exception Condition

Occurs when pixelWidth is less than zero.


Occurs when pixelHeight is less than zero.

The resulting bitmap has an effective size of pixelHeight × pixelWidth.

The returned BitmapSizeOptions will have its Rotation property set to Rotate0, its PreservesAspectRatio set to false, its PixelHeight set to the value of pixelHeight, and its PixelWidth set to the value of pixelWidth.

.NET Framework
Available since 3.0
Return to top