DpiHelper::CreateDeviceFromLogicalImage Method (Bitmap^, Size, Color, ImageScalingMode)

Visual Studio 2015
 

Creates and returns a new bitmap strip from the logical Bitmap scaled for the device units. When displayed on the device, the scaled image strip will have same size as the original image strip would have when displayed at 96dpi. This should be used for converting imagelists bitmap strips instead of simply scaling the bitmap, because the resultant bitmap strip size may be different from just upscaling as bitmap N * Math.Round(width * dpiscale) != Math.Round(N * width * dpiscale). This may happen depending on the image width because dpiscale is a double not an int.

Namespace:   Microsoft.VisualStudio.Utilities.Dpi
Assembly:  Microsoft.VisualStudio.Utilities (in Microsoft.VisualStudio.Utilities.dll)

public:
Bitmap^ CreateDeviceFromLogicalImage(
	Bitmap^ logicalBitmapStrip,
	Size logicalImageSize,
	Color backgroundColor,
	ImageScalingMode scalingMode = ImageScalingMode::Default
)

Parameters

logicalBitmapStrip
Type: System.Drawing::Bitmap^

The image strip to scale from logical units to device units.

logicalImageSize
Type: System.Drawing::Size

The size in logical unit of each image in the strip.

backgroundColor
Type: System.Drawing::Color

A Color value to be used for the image background. When the interpolation mode is Bilinear or Bicubic, the image's margins are interpolated with the background.

scalingMode
Type: Microsoft.VisualStudio.PlatformUI::ImageScalingMode

The scaling mode to use when scaling the images in the strip.

Return Value

Type: System.Drawing::Bitmap^

The bitmap.

Return to top
Show: