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 値のいずれか。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

適用対象

こちらもご覧ください