TranslateTransform 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
轉譯 (移動) 二維 x-y 座標系統中的物件。
public ref class TranslateTransform 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 TranslateTransform 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 TranslateTransform 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 TranslateTransform : 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 TranslateTransform : Transform
Public NotInheritable Class TranslateTransform
Inherits Transform
<TranslateTransform .../>
- 繼承
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
範例
此範例會使用 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 |
取得與此物件相關聯的 CoreDispatcher 。 CoreDispatcher代表可以存取 UI 執行緒上DependencyObject的功能,即使程式碼是由非 UI 執行緒起始也一樣。 (繼承來源 DependencyObject) |
Inverse |
如果可能,取得這個 GeneralTransform的反向轉換。 (繼承來源 GeneralTransform) |
InverseCore |
在衍生或自訂GeneralTransform中實作Inverse傳回值的行為。 (繼承來源 GeneralTransform) |
X |
取得或設定沿著 X 軸平移的距離。 |
XProperty |
識別 X 相依性屬性。 |
Y |
取得或設定要沿著 Y 軸平移 (移動) 物件的距離。 |
YProperty |
識別 Y 相依性屬性。 |