Gewusst wie: Transformieren einer Geometrie

Aktualisiert: November 2007

Dieses Beispiel zeigt, wie mithilfe der Transform-Eigenschaft ein RotateTransform auf ein Geometry-Objekt angewendet wird.

Beispiel

Das folgende Beispiel erstellt mithilfe einer GeometryGroup eine zusammengesetzte Form aus drei Geometry-Objekten, und dreht die Geometrie dann mithilfe der Transform-Eigenschaft um 45 Grad.

<Page  xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml">
  <Canvas>

    <!-- Displays the geometry. -->
    <Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
      <Path.Data>

        <!-- Creates a composite shape from three geometries. -->
        <GeometryGroup FillRule="EvenOdd">
          <LineGeometry StartPoint="10,10" EndPoint="50,30" />
          <EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
          <RectangleGeometry Rect="30,55 100 30" />

          <!-- Rotate the geometry 45 degrees using the Transform Property. -->
          <GeometryGroup.Transform>
            <RotateTransform CenterX="40" CenterY="70" Angle="45" />
          </GeometryGroup.Transform>
        </GeometryGroup>
      </Path.Data>
    </Path>

  </Canvas>
</Page>

Siehe auch

Konzepte

Übersicht über die Geometrie

Übersicht über Transformationen

Referenz

RotateTransform

Geometry