CompositeTransform 類別

定義

將多個轉換作業套用至 物件。

public ref class CompositeTransform 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 CompositeTransform 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 CompositeTransform 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 CompositeTransform : 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 CompositeTransform : Transform
Public NotInheritable Class CompositeTransform
Inherits Transform
<CompositeTransform .../>
繼承
Object Platform::Object IInspectable DependencyObject GeneralTransform Transform CompositeTransform
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

此範例示範如何使用 CompositeTransform 或 TransformGroup,將相同的轉換套用至物件。

<StackPanel Margin="50">
    <Canvas Background="Black" Width="200" Height="200">
        <Rectangle Height="100" Width="100" Fill="Red">
            <Rectangle.RenderTransform>

                <!-- This one line of markup is the equivalent of the entire
             TransformGroup block in the other Canvas below. -->
                <CompositeTransform SkewX="30" Rotation="45" ScaleX="0.8" ScaleY="0.8" />
            </Rectangle.RenderTransform>
        </Rectangle>
    </Canvas>

    <Canvas Margin="10" Background="Black" Width="200" Height="200">
        <Rectangle Height="100" Width="100" Fill="Red">
            <Rectangle.RenderTransform>
                <TransformGroup>

                    <!-- Note that you have to apply these transforms in 
                     a specific order to get the same effect as the
                     CompositeTransform. -->
                    <ScaleTransform ScaleX="0.8" ScaleY="0.8" />
                    <SkewTransform AngleX="30" />
                    <RotateTransform Angle="45" />
                </TransformGroup>
            </Rectangle.RenderTransform>
        </Rectangle>
    </Canvas>
</StackPanel>

備註

CompositeTransform 會依下列順序套用多個轉換:

  1. Scale (ScaleXScaleY )
  2. 扭曲 (扭曲X扭曲)
  3. 旋轉 (旋轉)
  4. 翻譯 (TranslateXTranslateY)

如果您想要以不同的順序將多個轉換套用至物件,您可以建立 TransformGroup ,並以您想要的順序插入轉換。

CompositeTransform 會針對所有轉換使用相同的中心點 (CenterXCenterY) 。 如果您想要為每個轉換指定不同的中心點,請使用 TransformGroup

建構函式

CompositeTransform()

初始化 CompositeTransform 類別的新實例。

屬性

CenterX

取得或設定與裝置無關圖元之 CompositeTransform 所指定之所有轉換的中心點 x 座標, (DIP) 相對於元素左上角。

CenterXProperty

識別 CenterX 相依性屬性。

CenterY

取得或設定與裝置無關圖元之 CompositeTransform 所指定之所有轉換的 Y 座標, (DIP) 相對於元素左上角。

CenterYProperty

識別 CenterY 相依性屬性。

Dispatcher

取得這個 物件相關聯的 CoreDispatcherCoreDispatcher代表可在 UI 執行緒上存取DependencyObject的功能,即使程式碼是由非 UI 執行緒起始也一樣。

(繼承來源 DependencyObject)
Inverse

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

(繼承來源 GeneralTransform)
InverseCore

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

(繼承來源 GeneralTransform)
Rotation

取得或設定順時針旋轉的角度 (以度為單位)。

RotationProperty

識別 Rotation 相依性屬性。

ScaleX

取得或設定 X 軸縮放比例。 您可以使用此屬性水準縮放或縮小物件。

ScaleXProperty

識別 ScaleX 相依性屬性。

ScaleY

取得或設定 Y 軸縮放比例。 您可以使用此屬性垂直縮放或縮小物件。

ScaleYProperty

識別 ScaleY 相依性屬性。

SkewX

取得或設定 X 軸扭曲角度 (以從 Y 軸逆時針算起的度數為測量單位)。 扭曲轉換對於在二維物件中建立三維深度的假像很有用。

SkewXProperty

識別 SkewX 相依性屬性。

SkewY

取得或設定 Y 軸扭曲角度 (以從 X 軸逆時針算起的度為測量單位)。 扭曲轉換對於在二維物件中建立三維深度的假像很有用。

SkewYProperty

識別 SkewY 相依性屬性。

TranslateX

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

TranslateXProperty

識別 TranslateX 相依性屬性。

TranslateY

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

TranslateYProperty

識別 TranslateY 相依性屬性。

方法

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)

適用於

另請參閱