TranslateTransform 類別

定義

轉譯 (移動) 二維 x-y 座標系統中的物件。

public ref class TranslateTransform sealed : Transform
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class TranslateTransform final : Transform
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class TranslateTransform : Transform
Public NotInheritable Class TranslateTransform
Inherits Transform
<TranslateTransform .../>
繼承
Object Platform::Object IInspectable DependencyObject GeneralTransform Transform TranslateTransform
屬性

範例

此範例會使用 TranslateTransform 來位移文字。 在此範例中,主要文字下方文字的略微位移複本會建立陰影效果。

<Canvas>

    <!-- Offset the text using a TranslateTransform. -->
    <TextBlock FontFamily="Verdana"
               FontSize="32"
               FontWeight="Bold" 
               Foreground="Black"
               Text="Translated Text">
        <TextBlock.RenderTransform>
            <TranslateTransform X="2" Y="2" />
        </TextBlock.RenderTransform>
    </TextBlock>

    <TextBlock FontFamily="Verdana"
               FontSize="32"
               FontWeight="Bold" 
               Foreground="Coral"
               Text="Translated Text"/>

</Canvas>
<Canvas Width="200" Height="200">
    <Rectangle PointerPressed="Rectangle_PointerPressed" 
               Width="50" Height="50" 
               Fill="RoyalBlue">
        <Rectangle.RenderTransform>
            <!-- If you give the transform a name 
                 you can access it easily from code. -->
            <TranslateTransform x:Name="myTranslateTransform" />
        </Rectangle.RenderTransform>
    </Rectangle>
</Canvas>
private void Rectangle_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
    // Increase the X and Y properties.
    myTranslateTransform.X = myTranslateTransform.X + 15;
    myTranslateTransform.Y = myTranslateTransform.Y + 15;
}

建構函式

TranslateTransform()

初始化 TranslateTransform 類別的新實例。

屬性

Dispatcher

一律會在 Windows 應用程式 SDK 應用程式中傳null回 。 請改用 DispatcherQueue

(繼承來源 DependencyObject)
DispatcherQueue

DispatcherQueue取得與這個 物件相關聯的 。 DispatcherQueue表示即使程式代碼是由非UI線程起始,也可以存取 DependencyObject UI線程上的設備。

(繼承來源 DependencyObject)
Inverse

如果可能的話,取得這個 GeneralTransform 的反向轉換。

(繼承來源 GeneralTransform)
InverseCore

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

(繼承來源 GeneralTransform)
X

取得或設定沿著 X 軸平移的距離。

XProperty

識別 X 相依性屬性。

Y

取得或設定要沿著 Y 軸平移 (移動) 物件的距離。

YProperty

識別 Y 相依性屬性。

方法

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)

適用於

另請參閱