Image.StretchDirection Image.StretchDirection Image.StretchDirection Image.StretchDirection Property

定義

イメージのスケーリング方法を示す値を取得または設定します。Gets or sets a value that indicates how the image is scaled.

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

プロパティ値

StretchDirection 値のいずれか 1 つ。One of the StretchDirection values. 既定値は、Both です。The default is Both.

このプロパティを使用する方法を次の例に示します。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

注釈

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

識別子フィールドIdentifier field StretchDirectionProperty
メタデータプロパティがに設定されるtrueMetadata properties set to true AffectsMeasure

適用対象

こちらもご覧ください