ManipulationDelta Classe

Definição

Contém dados de transformação acumulados quando ocorrem eventos de manipulação.Contains transformation data that is accumulated when manipulation events occur.

public ref class ManipulationDelta
public class ManipulationDelta
type ManipulationDelta = class
Public Class ManipulationDelta
Herança
ManipulationDelta

Exemplos

O exemplo a seguir mostra um manipulador de eventos ManipulationDelta para o evento.The following example shows an event handler for the ManipulationDelta event. O exemplo aplica as Translationpropriedades Scale,, Rotation e para mover, redimensionar e girar um Rectangle.The example applies the Translation, Scale, and Rotation properties to move, resize, and rotate a Rectangle. Este exemplo é parte de um exemplo maior em passo a passos: Criando seu primeiro aplicativode toque.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

Comentários

A ManipulationDelta classe contém informações sobre as alterações na posição de uma manipulação.The ManipulationDelta class contains information about the changes in the position of a manipulation. Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)interpreta as alterações como um Translation, Expansionou Rotation.interprets the changes as a Translation, Expansion, or Rotation. Quando o ManipulationDelta evento ocorrer em um UIElement, use as propriedades em um ManipulationDelta objeto para transformar o objeto que deve ser manipulado.When the ManipulationDelta event occurs on a UIElement, use the properties on a ManipulationDelta object to transform the object that should be manipulated. A ManipulationDeltaEventArgs classe fornece duas propriedades do tipo ManipulationDelta: DeltaManipulation e CumulativeManipulation.The ManipulationDeltaEventArgs class provides two properties of type ManipulationDelta: DeltaManipulation and CumulativeManipulation.

Para obter mais informações sobre manipulações, consulte a visão geral de entrada.For more information about manipulations, see the Input Overview. Para obter um exemplo de um aplicativo que responde a manipulações, consulte Passo a passos: Criando seu primeiro aplicativode toque.For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

Construtores

ManipulationDelta(Vector, Double, Vector, Vector)

Inicializa uma nova instância da classe ManipulationDelta.Initializes a new instance of the ManipulationDelta class.

Propriedades

Expansion

Obtém ou define a quantidade de redimensionamento da manipulação em unidades independentes de dispositivo (1/96 polegada por unidade)device-independent units (1/96th inch per unit).Gets or sets the amount the manipulation has resized in unidades independentes de dispositivo (1/96 polegada por unidade)device-independent units (1/96th inch per unit).

Rotation

Obtém ou define a rotação da manipulação em graus.Gets or sets the rotation of the manipulation in degrees.

Scale

Obtém ou define o valor que a manipulação redimensionou como um multiplicador.Gets or sets the amount the manipulation has resized as a multiplier.

Translation

Obtém ou define o movimento linear da manipulação.Gets or sets the linear motion of the manipulation.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Aplica-se a