Share via


方法 : MatrixTransform を使用してカスタム変換を作成する

この例では、MatrixTransform を使用して、Button の位置、伸縮、および傾斜を変換 (移動) する方法を示します。

メモメモ

RotateTransformSkewTransformScaleTransform、または TranslateTransform の各クラスでは提供されないカスタム変換を作成するには、MatrixTransform クラスを使用します。

使用例

<Page xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" >
  <StackPanel Margin="20">
    <Canvas HorizontalAlignment="Left" Width="340" Height="240" >

      <Button MinWidth="100">Click
        <Button.RenderTransform>
          <MatrixTransform x:Name="myMatrixTransform">
            <MatrixTransform.Matrix >

              <!-- OffsetX and OffsetY specify the position of the button,
              M11 stretches it, and M12 skews it. -->
              <Matrix OffsetX="10" OffsetY="100" M11="3" M12="2"/>
            </MatrixTransform.Matrix>
          </MatrixTransform>
        </Button.RenderTransform>
      </Button>
    </Canvas>
  </StackPanel>
</Page>

参照

参照

MatrixTransform

Transform

概念

変換の概要

WPF での図形と基本描画の概要

その他の技術情報

変換に関する方法のトピック