SkewTransform 类

定义

表示二维倾斜。

public ref class SkewTransform sealed : Transform
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SkewTransform final : Transform
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class SkewTransform final : Transform
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class SkewTransform : Transform
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SkewTransform : Transform
Public NotInheritable Class SkewTransform
Inherits Transform
<SkewTransform .../>
继承
Object Platform::Object IInspectable DependencyObject GeneralTransform Transform SkewTransform
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

此示例使用 SkewTransform 来倾斜文本。 倾斜也称为剪切,是一种以非均匀方式拉伸坐标空间的转换。 在此示例中,两个文本字符串沿 x 坐标倾斜 -30 度和 30 度。

<Canvas Margin="30">
    <!-- Skew the text using a SkewTransform. -->
    <TextBlock FontSize="32"
               FontWeight="Bold" 
               Foreground="Maroon"
               Text="Skewed Text">
        <TextBlock.RenderTransform>
            <SkewTransform AngleX="-30" AngleY="0" />
        </TextBlock.RenderTransform>
    </TextBlock>

    <TextBlock Canvas.Top="60"
               FontSize="32"
               FontWeight="Bold" 
               Foreground="Maroon"
               Text="Skewed Text">
        <TextBlock.RenderTransform>
            <SkewTransform AngleX="30" AngleY="0" />
        </TextBlock.RenderTransform>
    </TextBlock>
</Canvas>

应用转换后,文本如下所示:

应用了倾斜转换的文本

此示例演示如何在运行时访问和修改代码中的转换。 每次按下矩形时,倾斜都会增加。

<Rectangle PointerPressed="IncreaseSkew"
           Width="50" Height="50" 
           Fill="RoyalBlue">
    <Rectangle.RenderTransform>
        <!-- If you give the transform a name 
             you can access it easily from code. -->
        <SkewTransform x:Name="mySkewTransform" />
    </Rectangle.RenderTransform>
</Rectangle>
public void IncreaseSkew(object sender, RoutedEventArgs e)
{
    mySkewTransform.AngleX = mySkewTransform.AngleX + 5;
}

构造函数

SkewTransform()

初始化 SkewTransform 类的新实例。

属性

AngleX

获取或设置 x 轴倾斜角度,该角度是从 y 轴逆时针旋转后测量得到,单位为度。

AngleXProperty

标识 AngleX 依赖属性。

AngleY

获取或设置 y 轴倾斜角度,该角度通过测量从 x 轴逆时针旋转得到的角度度数得到。

AngleYProperty

标识 AngleY 依赖属性。

CenterX

获取或设置转换中心的 x 坐标。

CenterXProperty

标识 CenterX 依赖属性。

CenterY

获取或设置转换中心的 y 坐标。

CenterYProperty

标识 CenterY 依赖属性。

Dispatcher

获取与此对象关联的 CoreDispatcherCoreDispatcher 表示可以访问 UI 线程上的 DependencyObject 的工具,即使代码是由非 UI 线程启动的。

(继承自 DependencyObject)
Inverse

获取此 GeneralTransform 的反转换(如果可能)。

(继承自 GeneralTransform)
InverseCore

在派生的或自定义的 GeneralTransform 中实现 Inverse 的返回值的行为。

(继承自 GeneralTransform)

方法

ClearValue(DependencyProperty)

清除依赖属性的本地值。

(继承自 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

返回为依赖属性建立的任何基值,该基值适用于动画未处于活动状态的情况。

(继承自 DependencyObject)
GetValue(DependencyProperty)

DependencyObject 返回依赖属性的当前有效值。

(继承自 DependencyObject)
ReadLocalValue(DependencyProperty)

如果设置了本地值,则返回依赖属性的本地值。

(继承自 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

注册通知函数,用于侦听此 DependencyObject 实例上对特定 DependencyProperty 的更改。

(继承自 DependencyObject)
SetValue(DependencyProperty, Object)

设置 DependencyObject 上依赖属性的本地值。

(继承自 DependencyObject)
TransformBounds(Rect)

变换指定的边界框,并返回一个正好能容纳它的轴对齐的边界框。

(继承自 GeneralTransform)
TransformBoundsCore(Rect)

提供替代派生转换类中 TransformBounds 行为的方法。

(继承自 GeneralTransform)
TransformPoint(Point)

使用此转换对象的逻辑来转换指定的点,并返回结果。

(继承自 GeneralTransform)
TryTransform(Point, Point)

尝试变换指定的点,并返回指示变换是否成功的值。

(继承自 GeneralTransform)
TryTransformCore(Point, Point)

提供替代派生转换类中 TryTransform 行为的方法。

(继承自 GeneralTransform)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消以前通过调用 RegisterPropertyChangedCallback 注册的更改通知。

(继承自 DependencyObject)

适用于

另请参阅