Image.Stretch Image.Stretch Image.Stretch Image.Stretch Property

定義

Image を表示先の四角形全体に引き伸ばす方法を表す値を取得または設定します。Gets or sets a value that describes how an Image should be stretched to fill the destination rectangle.

public:
 property System::Windows::Media::Stretch Stretch { System::Windows::Media::Stretch get(); void set(System::Windows::Media::Stretch value); };
public System.Windows.Media.Stretch Stretch { get; set; }
member this.Stretch : System.Windows.Media.Stretch with get, set
Public Property Stretch As Stretch

プロパティ値

Stretch 値のいずれか。One of the Stretch values. 既定値は、Uniform です。The default is Uniform.

次の例では、このプロパティを使用する方法を示します。The following example demonstrates how to use this property.

Image myImage1 = new Image();

// Set the stretch property.
myImage1.Stretch = Stretch.Fill;

// Set the StretchDirection property.
myImage1.StretchDirection = StretchDirection.Both;

// Create source
BitmapImage myBitmapImage1 = new BitmapImage();

// BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage1.BeginInit();
myBitmapImage1.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg");
myBitmapImage1.EndInit();

//set image source
myImage1.Source = myBitmapImage1;
Dim myImage1 As New Image()

' Set the stretch property.
myImage1.Stretch = Stretch.Fill

' Set the StretchDirection property.
myImage1.StretchDirection = StretchDirection.Both

' Create source
Dim myBitmapImage1 As New BitmapImage()

' BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage1.BeginInit()
myBitmapImage1.UriSource = New Uri("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg")
myBitmapImage1.EndInit()

'set image source
myImage1.Source = myBitmapImage1

注釈

Fill引き伸ばして出力領域を完全に埋めるようにイメージになります。A value of Fill will cause your image to stretch to completely fill the output area. 出力領域とイメージの縦横比が異なる場合は、この引き伸ばしによってイメージがゆがめられます。When the output area and the image have different aspect ratios, the image is distorted by this stretching. させる、 Image 、イメージの縦横比を保持する、このプロパティを設定Uniform(既定値) またはUniformToFillします。To make an Image preserve the aspect ratio of the image, set this property to Uniform (default) or UniformToFill.

依存プロパティ情報Dependency Property Information

識別子フィールドです。Identifier field StretchProperty
メタデータのプロパティを設定するには trueMetadata properties set to true AffectsMeasure

適用対象

こちらもご覧ください