表示一种2-D扭曲。
程序集: PresentationCore(在 PresentationCore.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
SkewTransform 类型公开以下成员。
构造函数
页首
名称 | 说明 | |
---|---|---|
SkewTransform()()() | 初始化 SkewTransform 类的一个新实例。 | |
SkewTransform(Double, Double) | 初始化 SkewTransform 类的一个新实例,该实例具有指定的 x 轴和 y 轴角度并以原点为中心。 | |
SkewTransform(Double, Double, Double, Double) | 初始化 SkewTransform 类的一个新实例,该实例具有指定的 x 轴和 y 轴角度及中心。 |
属性
页首
名称 | 说明 | |
---|---|---|
AngleX | 获取或设置 x 轴扭曲角度,该角度从 y 轴开始沿逆时针方向测量,以度为单位。 | |
AngleY | 获取或设置 y 轴扭曲角度,该角度从 x 轴开始沿逆时针方向测量,以度为单位。 | |
CanFreeze | 获取一个值,该值指示是否可将对象变为不可修改。 (继承自 Freezable。) | |
CenterX | 获取或设置变换中心的 x 坐标。 | |
CenterY | 获取或设置变换中心的 y 坐标。 | |
DependencyObjectType | 获取对此实例的 CLR 类型进行包装的 DependencyObjectType。 (继承自 DependencyObject。) | |
Dispatcher | 获取与此 DispatcherObject 关联的 Dispatcher。 (继承自 DispatcherObject。) | |
HasAnimatedProperties | 获取一个值,该值指示一个或多个 AnimationClock 对象是否与此对象的任何依赖项属性相关联。 (继承自 Animatable。) | |
Inverse | 获取此变换的逆变换(如果存在)。 (继承自 Transform。) | |
IsFrozen | 获取一个值,该值指示对象当前是否可修改。 (继承自 Freezable。) | |
IsSealed | 获取一个值,该值指示此实例当前是否为密封的(只读)。 (继承自 DependencyObject。) | |
Value | 以 Matrix 形式获取当前的变换值。 (重写 Transform..::.Value。) |
方法
页首
字段
页首
名称 | 说明 | |
---|---|---|
AngleXProperty | 标识 AngleX 依赖项属性。 | |
AngleYProperty | 标识 AngleY 依赖项属性。 | |
CenterXProperty | 标识 CenterX 依赖项属性。 | |
CenterYProperty | 标识 CenterY 依赖项属性。 |
备注
SkewTransform 可用于在 2-D 对象中创建三维深度幻觉。
可冻结功能:由于继承自
Freezable 类,因此
SkewTransform 类提供了一些特殊功能:
SkewTransform 对象可按
资源中的方式进行声明、在多个对象之间共享、设为只读以提高性能、进行克隆以及设为线程安全。 有关
Freezable 对象提供的不同功能的更多信息,请参见
Freezable 对象概述。
示例
This example shows how to use a
SkewTransform to skew an element. A skew, which is also known as a shear, is a transformation that stretches the coordinate space in a non-uniform manner. One typical use of a
SkewTransform is for simulating 3-D depth in 2-D objects.
Use the
AngleX and
AngleY properties to specify the skew angle of the x-axis and y-axis, and to skew the current coordinate system along these axes.
To predict the effect of a skew transformation, consider that
AngleX skews x-axis values relative to the original coordinate system. Therefore, for an
AngleX of 30, the y-axis rotates 30 degrees through the origin and skews the values in x- by 30 degrees from that origin. Likewise, an
AngleY of 30 skews the y- values of the shape by 30 degrees from the origin. Note that this is not the same effect as translating (moving) the coordinate system by 30 degrees in x- or y-.
The following example applies a horizontal skew of 45 degrees to a
Rectangle from a center point of (0,0).
<Rectangle
Height="50" Width="50" Fill="#CCCCCCFF"
Stroke="Blue" StrokeThickness="2"
Canvas.Left="100" Canvas.Top="100">
<Rectangle.RenderTransform>
<!-- Applies a horizontal skew of 45 degrees
from a center point of (0,0). -->
<SkewTransform CenterX="0" CenterY="0" AngleX="45" AngleY="0" />
</Rectangle.RenderTransform>
</Rectangle>
The following example applies a horizontal skew of 45 degrees to a
Rectangle from a center point of (25,25).
<Rectangle Height="50" Width="50" Fill="#CCCCCCFF"
Canvas.Left="100" Canvas.Top="100"
Stroke="Blue" StrokeThickness="2">
<Rectangle.RenderTransform>
<!-- Applies a horizontal skew of 45 degrees
from a center point of (25,25). -->
<SkewTransform CenterX="25" CenterY="25" AngleX="45" AngleY="0" />
</Rectangle.RenderTransform>
</Rectangle>
The following example applies a vertical skew of 45 degrees to a
Rectangle from a center point of (25,25).
<Rectangle Height="50" Width="50" Fill="#CCCCCCFF"
Stroke="Blue" StrokeThickness="2"
Canvas.Left="100" Canvas.Top="100">
<Rectangle.RenderTransform>
<!-- Applies a vertical skew of 45 degrees
from a center point of (25,25). -->
<SkewTransform CenterX="25" CenterY="25" AngleX="0" AngleY="45" />
</Rectangle.RenderTransform>
</Rectangle>
The following illustration shows the different skews that are used in this example.
For the complete sample, see
2-D Transforms Sample.
平台
Windows 7, Windows Vista SP1 或更高版本, Windows XP SP3, Windows Server 2008(不支持服务器核心角色), Windows Server 2008 R2(不支持服务器核心角色), Windows Server 2003 SP2
.NET Framework 并不是对每个平台的所有版本都提供支持。 有关支持的版本的列表,请参见.NET Framework 系统要求。
转载于:https://blog.51cto.com/2063557/537902