ManipulationDeltaEventArgs 类   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为 ManipulationDelta 事件提供数据。
public ref class ManipulationDeltaEventArgs sealed : System::Windows::Input::InputEventArgspublic sealed class ManipulationDeltaEventArgs : System.Windows.Input.InputEventArgstype ManipulationDeltaEventArgs = class
    inherit InputEventArgsPublic NotInheritable Class ManipulationDeltaEventArgs
Inherits InputEventArgs- 继承
示例
以下示例演示事件的事件处理程序 ManipulationDelta 。 该示例使用 DeltaManipulation 属性移动、调整大小和旋转 Rectangle。 该示例还检查事件是否 ManipulationDelta 在惯性期间发生,以及矩形是否触摸窗口的边缘。 如果这些情况为 true,应用程序将停止操作,以防止矩形离开应用程序的可见区域。 此示例是 演练:创建第一个触摸应用程序中较大示例的一部分。
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
注解
类 ManipulationDeltaEventArgs 包含有关操作位置更改的数据。 属性 DeltaManipulation 包含自上次 ManipulationDelta 事件发生以来发生的更改。 属性 CumulativeManipulation 包含当前操作发生的总更改。 使用这些属性之一来转换被操作的对象。
可以通过调用 方法结束操作, Complete 也可以通过调用 StartInertia 方法强制操作进入惯性。
属性
| CumulativeManipulation | 获取当前操作的累积更改。 | 
| DeltaManipulation | 获取当前操作的最近更改。 | 
| Device | 获取启动此事件的输入设备。(继承自 InputEventArgs) | 
| Handled | 获取或设置一个值,该值指示针对路由事件(在其经过路由时)的事件处理的当前状态。(继承自 RoutedEventArgs) | 
| IsInertial | 获取一个值,该值指示 ManipulationDelta 事件是否在惯性期间发生。 | 
| ManipulationContainer | 获取定义操作坐标的容器。 | 
| ManipulationOrigin | 获取操作的起源点。 | 
| Manipulators | 获取表示操作的触摸触点的对象集合。 | 
| OriginalSource | 在父类进行任何可能的 Source 调整之前,获取由纯命中测试确定的原始报告源。(继承自 RoutedEventArgs) | 
| RoutedEvent | 获取或设置与此 RoutedEventArgs 实例关联的 RoutedEvent。(继承自 RoutedEventArgs) | 
| Source | 获取或设置对引发事件的对象的引用。(继承自 RoutedEventArgs) | 
| Timestamp | 获取此事件发生时的时间。(继承自 InputEventArgs) | 
| Velocities | 获取对操作进行的最近更改的速率。 | 
方法
| Cancel() | 取消操作。 | 
| Complete() | 完成操作而不发生惯性。 | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| InvokeEventHandler(Delegate, Object) | 以特定于类型的方式调用事件处理程序,这样做可以提高事件系统效率。(继承自 InputEventArgs) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| OnSetSource(Object) | 在派生类中重写时,每当实例的 Source 属性的值发生更改,则提供一个通知回调入口点。(继承自 RoutedEventArgs) | 
| ReportBoundaryFeedback(ManipulationDelta) | 指明该操作已经超出了一定界限。 | 
| StartInertia() | 通过忽略后来的接触运动并引发 ManipulationInertiaStarting 事件对操作启动惯性。 | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) |