次の方法で共有


DpiPrescaledImageExtension Class

Definition

Caution

Callers should use the CrispImage control for properly scaled images. Additionally, in some cases this markup extension can cause crashes.

MarkupExtension class that can be used to declare image sources in xaml and have the image pre-scaled for High DPI at zoom levels higher than 200%, using NearestNeighbor up to the largest multiple of 100%.

A common usage pattern can look like this: or <Image.LayoutTransform></Image.LayoutTransform>

Note that when using image pre-scaling, either the original image size has to be specified, or a reverse layout transform has to be applied to the result, to maintain the desired original image size

public ref class DpiPrescaledImageExtension sealed : Microsoft::VisualStudio::Imaging::Dpi::DpiPrescaledImageExtension
public sealed class DpiPrescaledImageExtension : Microsoft.VisualStudio.Imaging.Dpi.DpiPrescaledImageExtension
[System.Obsolete("Callers should use the CrispImage control for properly scaled images. Additionally, in some cases this markup extension can cause crashes.")]
public sealed class DpiPrescaledImageExtension : Microsoft.VisualStudio.Imaging.Dpi.DpiPrescaledImageExtension
type DpiPrescaledImageExtension = class
    inherit DpiPrescaledImageExtension
[<System.Obsolete("Callers should use the CrispImage control for properly scaled images. Additionally, in some cases this markup extension can cause crashes.")>]
type DpiPrescaledImageExtension = class
    inherit DpiPrescaledImageExtension
Public NotInheritable Class DpiPrescaledImageExtension
Inherits DpiPrescaledImageExtension
Inheritance
DpiPrescaledImageExtension
Attributes

Remarks

A common usage pattern can look like this:

<Image Source="{imaging:DpiPrescaledImage resources/MyImage.png}" Width="16" Height="16" />  

or

<Image Source="{imaging:DpiPrescaledImage resources/MyImage.png}" Stretch="None">  
    <Image.LayoutTransform>  
    <ScaleTransform ScaleX="{x:Static utilities:DpiHelper.Default.PreScaledImageLayoutTransformScaleX}" ScaleY="{x:Static utilities:DpiHelper.Default.PreScaledImageLayoutTransformScaleY}" />  
    </Image.LayoutTransform>  
</Image>  

Note that when using image pre-scaling, either the original image size has to be specified, or a reverse layout transform has to be applied to the result, to maintain the desired original image size.

Constructors

DpiPrescaledImageExtension()

Initializes a new instance of DpiPrescaleImageExtension.

DpiPrescaledImageExtension(String)

Initializes a new instance of DpiPrescaleImageExtension.

Properties

PrescalingConverter

Gets an instance of the DpiPrescaleImageSourceConverter.

(Inherited from DpiPrescaledImageExtension)
Uri

Gets or sets the URI.

(Inherited from DpiPrescaledImageExtension)

Methods

ProvideValue(IServiceProvider) (Inherited from DpiPrescaledImageExtension)

Applies to