ManipulationDelta ManipulationDelta ManipulationDelta ManipulationDelta Class

Definición

Contiene los datos de la transformación que se acumulan cuando se producen eventos de manipulación.Contains transformation data that is accumulated when manipulation events occur.

public ref class ManipulationDelta
public class ManipulationDelta
type ManipulationDelta = class
Public Class ManipulationDelta
Herencia
ManipulationDeltaManipulationDeltaManipulationDeltaManipulationDelta

Ejemplos

En el ejemplo siguiente se muestra un controlador de ManipulationDelta eventos para el evento.The following example shows an event handler for the ManipulationDelta event. En el ejemplo se Translationaplican las Rotation propiedades, Scaley para desplazarse, cambiar el Rectangletamaño y girar un.The example applies the Translation, Scale, and Rotation properties to move, resize, and rotate a Rectangle. Este ejemplo forma parte de un ejemplo más grande en el tutorial: Crear la primera aplicacióntáctil.This example is part of a larger example 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

Comentarios

La ManipulationDelta clase contiene información sobre los cambios en la posición de una manipulación.The ManipulationDelta class contains information about the changes in the position of a manipulation. Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)interpreta los cambios como Translation, Expansiono Rotation.interprets the changes as a Translation, Expansion, or Rotation. Cuando el ManipulationDelta evento se produce UIElementen, utilice las propiedades de un ManipulationDelta objeto para transformar el objeto que debe manipularse.When the ManipulationDelta event occurs on a UIElement, use the properties on a ManipulationDelta object to transform the object that should be manipulated. La ManipulationDeltaEventArgs clase proporciona dos propiedades de tipo ManipulationDelta: DeltaManipulation y CumulativeManipulation.The ManipulationDeltaEventArgs class provides two properties of type ManipulationDelta: DeltaManipulation and CumulativeManipulation.

Para obtener más información sobre las manipulaciones, vea Introducción a la entrada.For more information about manipulations, see the Input Overview. Para obtener un ejemplo de una aplicación que responde a las manipulaciones, vea Tutorial: Crear la primera aplicacióntáctil.For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

Constructores

ManipulationDelta(Vector, Double, Vector, Vector) ManipulationDelta(Vector, Double, Vector, Vector) ManipulationDelta(Vector, Double, Vector, Vector) ManipulationDelta(Vector, Double, Vector, Vector)

Inicializa una nueva instancia de la clase ManipulationDelta.Initializes a new instance of the ManipulationDelta class.

Propiedades

Expansion Expansion Expansion Expansion

Obtiene o establece el cambio de tamaño de la manipulación en unidades independientes de dispositivo (1/96 de pulgada por unidad)device-independent units (1/96th inch per unit).Gets or sets the amount the manipulation has resized in unidades independientes de dispositivo (1/96 de pulgada por unidad)device-independent units (1/96th inch per unit).

Rotation Rotation Rotation Rotation

Obtiene o establece la rotación de la manipulación en grados.Gets or sets the rotation of the manipulation in degrees.

Scale Scale Scale Scale

Obtiene o establece el cambio de tamaño de la manipulación expresado como un multiplicador.Gets or sets the amount the manipulation has resized as a multiplier.

Translation Translation Translation Translation

Obtiene o establece el movimiento lineal de la manipulación.Gets or sets the linear motion of the manipulation.

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a