Image.StretchDirection Свойство

Определение

Получает или задает значение, показывающее, как масштабировано изображение.

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. Значение по умолчанию — Both.

Примеры

В следующем примере показано, как использовать это свойство.

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

Комментарии

Сведения о свойстве зависимостей

Поле идентификатора StretchDirectionProperty
Для свойств метаданных задано значение true AffectsMeasure

Применяется к

См. также раздел