Partager via


IXRImage::SetStretch (Compact 2013)

3/28/2014

This method sets a value that describes how an image should be stretched to fill the destination rectangle.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetStretch(
    XRStretch Stretch
) = 0;

Parameters

  • Stretch
    [in] XRStretch enumerated type that specifies how the source image is rendered if the Height and Width of the IXRImage are both specified and different from the height and width of the source image.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

If you set Stretch to XRStretch_Fill, the image is stretched to completely fill the output area. When the output area and the image have different aspect ratios, the image is distorted by this kind of stretching. To make an IXRImage preserve the aspect ratio of the image, set Stretch to XRStretch_Uniform or XRStretch_UniformToFill.

Alternatively, you can decide not to set the Height and Width by not calling the inherited methods IXRFrameworkElement::SetHeight and IXRFrameworkElement::SetWidth, which will display the image source at its true resolution. However, this results in a loss of control over the element sizing in the source XAML for your application.

.NET Framework Equivalent

System.Windows.Controls.Image.Stretch

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRImage
IXRImage::GetStretch