Image.Stretch 속성

정의

Image 대상 사각형을 채우기 위해 늘여야 하는 방법을 설명하는 값을 가져오거나 설정합니다.

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

Stretch 값 중 하나입니다. 기본값은 Uniform입니다.

예제

다음 예제에서는이 속성을 사용 하는 방법을 보여 줍니다.

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 이 있으면 이미지가 늘이면 출력 영역이 완전히 채워지게 됩니다. 출력 영역과 이미지의 가로 세로 비율이 다르면 이미지가 확장되면서 왜곡됩니다. 이미지의 가로 세로 Image 비율을 유지하려면 이 속성을 Uniform (기본값) 또는 UniformToFill.로 설정합니다.

종속성 속성 정보

식별자 필드 StretchProperty
메타 데이터 속성 설정 true AffectsMeasure

적용 대상

추가 정보