Rotation 枚举

定义

指定要应用到位图图像的旋转。

C#
public enum Rotation
继承
Rotation

字段

Rotate0 0

不旋转位图。 这是默认值。

Rotate180 2

将位图顺时针旋转 180 度。

Rotate270 3

将位图顺时针旋转 270 度。

Rotate90 1

将位图顺时针旋转 90 度。

示例

以下示例演示如何将旋转应用于位图图像。

C#
// Define a BitmapImage.
Image myImage = new Image();
BitmapImage bi = new BitmapImage();

// Begin initialization.
bi.BeginInit();

// Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand;
bi.CreateOptions = BitmapCreateOptions.DelayCreation;
bi.DecodePixelHeight = 125;
bi.DecodePixelWidth = 125;
bi.Rotation = Rotation.Rotate90;
MessageBox.Show(bi.IsDownloading.ToString());
bi.UriSource = new Uri("smiley.png", UriKind.Relative);

// End initialization.
bi.EndInit();
myImage.Source = bi;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(5);

注解

仅支持 90 度的增量。

适用于

产品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

另请参阅