BitmapImage.Rotation 속성

정의

BitmapImage를 회전하는 각도를 가져오거나 설정합니다.

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

속성 값

Rotation

BitmapImage에 사용되는 회전입니다. 기본값은 Rotate0입니다.

예제

다음 코드 예제에서는 XAML(Extensible Application Markup Language) 및 코드를 사용하여 이미지를 회전하는 방법을 보여 줍니다.

<Image Width="150" Margin="5" Grid.Column="0" Grid.Row="1">
  <Image.Source>
    <TransformedBitmap Source="/sampleImages/watermelon.jpg" >
      <TransformedBitmap.Transform>
        <RotateTransform Angle="90"/>
      </TransformedBitmap.Transform>
    </TransformedBitmap>
  </Image.Source>
</Image>
// Create Image element.
Image rotated90 = new Image();
rotated90.Width = 150;

// Create the TransformedBitmap to use as the Image source.
TransformedBitmap tb = new TransformedBitmap();

// Create the source to use as the tb source.
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(@"sampleImages/watermelon.jpg", UriKind.RelativeOrAbsolute);
bi.EndInit();

// Properties must be set between BeginInit and EndInit calls.
tb.BeginInit();
tb.Source = bi;
// Set image rotation.
RotateTransform transform = new RotateTransform(90);
tb.Transform = transform;
tb.EndInit();
// Set the Image source.
rotated90.Source = tb;
' Create Image element.
Dim rotated90 As New Image()
rotated90.Width = 150

' Create the TransformedBitmap to use as the Image source.
Dim tb As New TransformedBitmap()

' Create the source to use as the tb source.
Dim bi As New BitmapImage()
bi.BeginInit()
bi.UriSource = New Uri("sampleImages/watermelon.jpg", UriKind.RelativeOrAbsolute)
bi.EndInit()

' Properties must be set between BeginInit and EndInit calls.
tb.BeginInit()
tb.Source = bi
' Set image rotation.
Dim transform As New RotateTransform(90)
tb.Transform = transform
tb.EndInit()
' Set the Image source.
rotated90.Source = tb

설명

회전은 크기 조정 후 수행 됩니다. 즉, 있는 이미지를 RotationRotate90, DecodePixelWidth 10 및 DecodePixelHeight 5 5의 너비 및 높이가 10 있는 이미지에 발생 합니다.

종속성 속성 정보

식별자 필드 RotationProperty
메타 데이터 속성 설정 true 없음

적용 대상

추가 정보