DpiHelper.DpiHelperImplementation Class

Definition

The DpiHelper actual implementation. Derives from the Microsoft.VisualStudio.Utilities.Dpi.DpiHelper scaling helper, and overrides a couple of functions allowing user-override of the scaling algorithms via registry settings under the running appid's hive.

public: ref class DpiHelper::DpiHelperImplementation : Microsoft::VisualStudio::Utilities::Dpi::DpiHelper
[Windows::Foundation::Metadata::WebHostHidden]
class DpiHelper::DpiHelperImplementation : Microsoft::VisualStudio::Utilities::Dpi::DpiHelper
public class DpiHelper.DpiHelperImplementation : Microsoft.VisualStudio.Utilities.Dpi.DpiHelper
type DpiHelper.DpiHelperImplementation = class
    inherit DpiHelper
Public Class DpiHelper.DpiHelperImplementation
Inherits DpiHelper
Inheritance
DpiHelper.DpiHelperImplementation

Constructors

DpiHelper.DpiHelperImplementation()

Initializes a new instance of DpiHelperImplementation.

Fields

DefaultLogicalDpi

The default logical DPI.

(Inherited from DpiHelper)

Properties

BitmapScalingMode

Retuns the BitmapScalingMode algorithm to be used for resizing images in WPF. This allows the shell to control the algorithm depending on the DPI zoom scale, and allows the user to override it via registry settings like General\BitmapScalingXXX = (BitmapScalingMode)value, with XXX the zoom factor in percents, e.g. BitmapScaling150, etc. Note that for WPF scaling, there is an additional registry value that applies for zoom factors > 200%, UseBitmapPreScalingXXX

(Inherited from DpiHelper)
DeviceDpiX

The screen's (device) current horizontal DPI

(Inherited from DpiHelper)
DeviceDpiY

The screen's (device) current vertical DPI

(Inherited from DpiHelper)
DeviceToLogicalUnitsScalingFactorX

Converts to the horizontal logical units scaling factor.

(Inherited from DpiHelper)
DeviceToLogicalUnitsScalingFactorY

Converts to the vertical logical units scaling factor.

(Inherited from DpiHelper)
DpiScalePercentX (Inherited from DpiHelper)
DpiScalePercentY (Inherited from DpiHelper)
ImageScalingMode

Retuns the ImageScalingMode algorithm to be used for resizing images in WinForms/Win32. This allows the shell to control the algorithm depending on the DPI zoom scale, and allows the user to override it via registry settings like General\ImageScalingXXX = (ImageScalingMode)value, with XXX the zoom factor in percents, e.g. ImageScaling150, etc.

(Inherited from DpiHelper)
IsScalingRequired

Returns whether scaling is required when converting between logical-device units

(Inherited from DpiHelper)
LogicalDpiX

The helper's logical horizontal DPI

(Inherited from DpiHelper)
LogicalDpiY

The helper's logical vertical DPI

(Inherited from DpiHelper)
LogicalToDeviceUnitsScalingFactorX (Inherited from DpiHelper)
LogicalToDeviceUnitsScalingFactorY (Inherited from DpiHelper)
PreScaledImageLayoutTransformScaleX

Return the horizontal scale value that should be used with a LayoutTransform/ScaleTransform to scale back an image pre-scaled in HighDPI with DpiPrescaleImageSourceConverter in order to obtain crisp results

(Inherited from DpiHelper)
PreScaledImageLayoutTransformScaleY

Return the vertical scale value that should be used with a LayoutTransform/ScaleTransform to scale back an image pre-scaled in HighDPI with DpiPrescaleImageSourceConverter in order to obtain crisp results

(Inherited from DpiHelper)
SettingsStore
TransformFromDevice (Inherited from DpiHelper)
TransformToDevice (Inherited from DpiHelper)
UsePreScaledImages

Returns whether images should be pre-scaled at zoom levels higher than 200%, using NearestNeighbor up to the largest multiple of 100%

(Inherited from DpiHelper)

Methods

CreateDeviceFromLogicalImage(Bitmap, Size, Color, ImageScalingMode)

Creates and returns a new bitmap strip from the logical System.Drawing.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.

(Inherited from DpiHelper)
CreateDeviceFromLogicalImage(Bitmap, Size, ImageScalingMode)

Creates and returns a new bitmap strip from the logical System.Drawing.Bitmap strip scaled for the device units, using NearestNeighbor interpolation. 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.

(Inherited from DpiHelper)
CreateDeviceFromLogicalImage(Icon, ImageScalingMode)

Creates and returns a new icon scaled for the device units. When displayed on the device, the scaled icon will have same size as the original icon would have when displayed at 96dpi.

(Inherited from DpiHelper)
CreateDeviceFromLogicalImage(Image, Color, ImageScalingMode)

Creates and returns a new bitmap or metafile from the logical System.Drawing.Image scaled for the device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

(Inherited from DpiHelper)
CreateDeviceFromLogicalImage(Image, ImageScalingMode)

Creates and returns a new bitmap or metafile from the logical System.Drawing.Image scaled for the device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

(Inherited from DpiHelper)
CreateDeviceFromLogicalImage(ImageList, Color, ImageScalingMode)

Creates and returns a new imagelist scaled for the device units When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

(Inherited from DpiHelper)
CreateDeviceFromLogicalImage(ImageList, ImageScalingMode)

Creates and returns a new imagelist scaled for the device units When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

(Inherited from DpiHelper)
DeviceToLogicalUnits(Point)

Returns a new Point with the input's coordinates converted from device units to logical units.

(Inherited from DpiHelper)
DeviceToLogicalUnits(Rect)

Returns a new Rect with the input's coordinates converted from device units to logical units.

(Inherited from DpiHelper)
DeviceToLogicalUnits(Size)

Returns a new Size with the input's dimensions converted from device units to logical units.

(Inherited from DpiHelper)
DeviceToLogicalUnits(Thickness)

Returns a new Thickness with the input's dimensions converted from device units to logical units.

(Inherited from DpiHelper)
DeviceToLogicalUnitsX(Double)

Transforms a horizontal coordinate from device to logical units

(Inherited from DpiHelper)
DeviceToLogicalUnitsX(Int32)

Transforms a horizontal integer coordinate from device to logical units

(Inherited from DpiHelper)
DeviceToLogicalUnitsX(Single)

Transforms a horizontal coordinate from device to logical units

(Inherited from DpiHelper)
DeviceToLogicalUnitsY(Double)

Transforms a vertical coordinate from device to logical units

(Inherited from DpiHelper)
DeviceToLogicalUnitsY(Int32)

Transforms a vertical integer coordinate from device to logical units

(Inherited from DpiHelper)
DeviceToLogicalUnitsY(Single)

Transforms a vertical coordinate from device to logical units

(Inherited from DpiHelper)
GetBitmapScalingModeOverride(Int32, BitmapScalingMode)

Gets the bitmap scaling mode override.

GetDeviceActualSize(FrameworkElement)

Get the FrameworkElement's Size in device units

(Inherited from DpiHelper)
GetDeviceHeight(Window)

Gets the window's Height in device units

(Inherited from DpiHelper)
GetDeviceLeft(Window)

Gets the window's Left coordinate in device units

(Inherited from DpiHelper)
GetDeviceRect(Window)

Gets the window's Rectangle in device units

(Inherited from DpiHelper)
GetDeviceTop(Window)

Gets the window's Top coordinate in device units

(Inherited from DpiHelper)
GetDeviceWidth(Window)

Gets the window's Width in device units

(Inherited from DpiHelper)
GetImageScalingModeOverride(Int32, ImageScalingMode)

Gets the image scaling mode override.

GetUsePreScaledImagesOverride(Int32, Boolean)

Determines whether prescaled images should be used.

LogicalToDeviceUnits(Bitmap, Color, ImageScalingMode)

Converts (if necessary) the image by scaling it to device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Bitmap, ImageScalingMode)

Converts (if necessary) the image by scaling it to device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Bitmap, Size, Color, ImageScalingMode)

Converts (if necessary) the image strip to device units, using NearestNeighbor interpolation.. 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.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Bitmap, Size, ImageScalingMode)

Converts (if necessary) the image strip to device units, using NearestNeighbor interpolation.. 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.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Icon, ImageScalingMode)

Converts (if necessary) the icon by scaling it to device units. When displayed on the device, the scaled icon will have same size as the original icon would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Image, Color, ImageScalingMode)

Converts (if necessary) the image by scaling it to device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Image, ImageScalingMode)

Converts (if necessary) the image by scaling it to device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(ImageList, Color, ImageScalingMode)

Converts (if necessary) the imagelist by scaling it to device units. When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(ImageList, ImageScalingMode)

Converts (if necessary) the imagelist by scaling it to device units. When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Point)

Returns a new Point with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Point)

Returns a new System.Drawing.Point with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(PointF)

Returns a new System.Drawing.PointF with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Rect)

Returns a new Rect with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Rectangle)

Returns a new System.Drawing.Rectangle with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(RectangleF)

Returns a new System.Drawing.RectangleF with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Size)

Returns a new System.Drawing.Size with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Size)

Returns a new Size with the input's dimensions converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(SizeF)

Returns a new System.Drawing.SizeF with the input's coordinates converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnits(Thickness)

Returns a new Thickness with the input's dimensions converted from logical units to device units.

(Inherited from DpiHelper)
LogicalToDeviceUnitsX(Double)

Transforms a horizontal coordinate from logical to device units

(Inherited from DpiHelper)
LogicalToDeviceUnitsX(Int32)

Transforms a horizontal integer coordinate from logical to device units by scaling it up for current DPI and rounding to nearest integer value

(Inherited from DpiHelper)
LogicalToDeviceUnitsX(Single)

Transforms a horizontal coordinate from logical to device units

(Inherited from DpiHelper)
LogicalToDeviceUnitsY(Double)

Transforms a vertical coordinate from logical to device units

(Inherited from DpiHelper)
LogicalToDeviceUnitsY(Int32)

Transforms a vertical integer coordinate from logical to device units by scaling it up for current DPI and rounding to nearest integer value

(Inherited from DpiHelper)
LogicalToDeviceUnitsY(Single)

Transforms a vertical coordinate from logical to device units

(Inherited from DpiHelper)
RoundToDeviceUnitsX(Double)

Returns the closest value in logical units that will be converted to an integer value if it is converted back to device units using functions for horizontal coordinates/widths such as DeviceToLogicalUnitsX.

(Inherited from DpiHelper)
RoundToDeviceUnitsY(Double)

Returns the closest value in logical units that will be converted to an integer value if it is converted back to device units using functions for vertical coordinates/widths such as DeviceToLogicalUnitsY.

(Inherited from DpiHelper)
ScaleLogicalImageForDeviceSize(ImageSource, Size, BitmapScalingMode)

Scale a WPF image to the indicated size, using the specified scalingMode

(Inherited from DpiHelper)
SetDeviceHeight(Window, Double)

Sets the window's Height using device units

(Inherited from DpiHelper)
SetDeviceLeft(Window, Double)

Sets the window's Left coordinate using device units

(Inherited from DpiHelper)
SetDeviceTop(Window, Double)

Sets the window's Top coordinate using device units

(Inherited from DpiHelper)
SetDeviceWidth(Window, Double)

Sets the window's Width using device units

(Inherited from DpiHelper)

Applies to