ManipulationDelta Klasse

Definition

Enthält Transformationsdaten, die akkumuliert werden, wenn Manipulationsereignisse auftreten.

public ref class ManipulationDelta
public class ManipulationDelta
type ManipulationDelta = class
Public Class ManipulationDelta
Vererbung
ManipulationDelta

Beispiele

Das folgende Beispiel zeigt einen Ereignishandler für das ManipulationDelta Ereignis. Im Beispiel werden die Eigenschaften und Eigenschaften angewendet, um die TranslationScaleRotation Größe zu verschieben, zu ändern und zu drehen.Rectangle Dieses Beispiel ist Teil eines größeren Beispiels in Walkthrough: Creating Your First Touch Application.

void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
    
    // Get the Rectangle and its RenderTransform matrix.
    Rectangle rectToMove = e.OriginalSource as Rectangle;
    Matrix rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

    // Rotate the Rectangle.
    rectsMatrix.RotateAt(e.DeltaManipulation.Rotation, 
                         e.ManipulationOrigin.X, 
                         e.ManipulationOrigin.Y);

    // Resize the Rectangle.  Keep it square 
    // so use only the X value of Scale.
    rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X, 
                        e.DeltaManipulation.Scale.X, 
                        e.ManipulationOrigin.X,
                        e.ManipulationOrigin.Y);

    // Move the Rectangle.
    rectsMatrix.Translate(e.DeltaManipulation.Translation.X,
                          e.DeltaManipulation.Translation.Y);

    // Apply the changes to the Rectangle.
    rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);

    Rect containingRect =
        new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

    Rect shapeBounds =
        rectToMove.RenderTransform.TransformBounds(
            new Rect(rectToMove.RenderSize));

    // Check if the rectangle is completely in the window.
    // If it is not and intertia is occuring, stop the manipulation.
    if (e.IsInertial && !containingRect.Contains(shapeBounds))
    {
        e.Complete();
    }

    e.Handled = true;
}
Private Sub Window_ManipulationDelta(ByVal sender As Object, ByVal e As ManipulationDeltaEventArgs)

    ' Get the Rectangle and its RenderTransform matrix.
    Dim rectToMove As Rectangle = e.OriginalSource
    Dim rectTransform As MatrixTransform = rectToMove.RenderTransform
    Dim rectsMatrix As Matrix = rectTransform.Matrix


    ' Rotate the shape
    rectsMatrix.RotateAt(e.DeltaManipulation.Rotation,
                         e.ManipulationOrigin.X,
                         e.ManipulationOrigin.Y)

    ' Resize the Rectangle. Keep it square 
    ' so use only the X value of Scale.
    rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                        e.DeltaManipulation.Scale.X,
                        e.ManipulationOrigin.X,
                        e.ManipulationOrigin.Y)

    'move the center
    rectsMatrix.Translate(e.DeltaManipulation.Translation.X,
                          e.DeltaManipulation.Translation.Y)

    ' Apply the changes to the Rectangle.
    rectTransform = New MatrixTransform(rectsMatrix)
    rectToMove.RenderTransform = rectTransform

    Dim container As FrameworkElement = e.ManipulationContainer
    Dim containingRect As New Rect(container.RenderSize)

    Dim shapeBounds As Rect = rectTransform.TransformBounds(
                                New Rect(rectToMove.RenderSize))

    ' Check if the rectangle is completely in the window.
    ' If it is not and intertia is occuring, stop the manipulation.
    If e.IsInertial AndAlso Not containingRect.Contains(shapeBounds) Then
        e.Complete()
    End If

    e.Handled = True
End Sub

Hinweise

Die ManipulationDelta Klasse enthält Informationen zu den Änderungen an der Position einer Manipulation. Windows Presentation Foundation (WPF) interpretiert die Änderungen als ein Translation, Expansionoder Rotation. Wenn das ManipulationDelta Ereignis auf einem UIElementEreignis auftritt, verwenden Sie die Eigenschaften eines ManipulationDelta Objekts, um das Objekt zu transformieren, das bearbeitet werden soll. Die ManipulationDeltaEventArgs Klasse enthält zwei Eigenschaften vom Typ ManipulationDelta: DeltaManipulation und CumulativeManipulation.

Weitere Informationen zu Manipulationen finden Sie in der Eingabeübersicht. Ein Beispiel für eine Anwendung, die auf Manipulationen reagiert, finden Sie unter Walkthrough: Creating Your First Touch Application.

Konstruktoren

ManipulationDelta(Vector, Double, Vector, Vector)

Initialisiert eine neue Instanz der ManipulationDelta-Klasse.

Eigenschaften

Expansion

Dient zum Abrufen oder Festlegen der Größe der Manipulation in geräteunabhängigen Einheiten (1/96. Zoll pro Einheit).

Rotation

Ruft die Manipulationsdrehung in Grad ab oder legt diese fest.

Scale

Ruft den Betrag, um den die Größe geändert wurde, als Multiplikator ab oder legt diesen fest.

Translation

Ruft die lineare Geschwindigkeit der Manipulation ab oder legt sie fest.

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für: