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

實作衍生或自訂GeneralTransformInverse傳回值的行為。

(繼承來源 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)

適用於

另請參閱