_IManipulationEvents::ManipulationDelta 方法 (manipulations.h)

处理在被操作的对象更改时发生的事件。

语法

HRESULT ManipulationDelta(
  [in] FLOAT x,
  [in] FLOAT y,
  [in] FLOAT translationDeltaX,
  [in] FLOAT translationDeltaY,
  [in] FLOAT scaleDelta,
  [in] FLOAT expansionDelta,
  [in] FLOAT rotationDelta,
  [in] FLOAT cumulativeTranslationX,
  [in] FLOAT cumulativeTranslationY,
  [in] FLOAT cumulativeScale,
  [in] FLOAT cumulativeExpansion,
  [in] FLOAT cumulativeRotation
);

参数

[in] x

用户定义坐标中的原点 x 坐标。

[in] y

用户定义的坐标中的原点 y 坐标。

[in] translationDeltaX

自上次事件以来,用户定义坐标中的 x 轴的平移变化。

[in] translationDeltaY

自上次事件以来,用户定义的坐标中的 y 轴的平移变化。

[in] scaleDelta

自上一个事件以来,比例变化为上一个比例的百分比。

[in] expansionDelta

自用户定义坐标中的上一个事件以来的扩展更改。

[in] rotationDelta

自上一个事件以来的旋转变化(以弧度为单位)。

[in] cumulativeTranslationX

自用户定义坐标开始操作以来,有关 x 轴的平移。

[in] cumulativeTranslationY

自用户定义坐标中操作开始以来的 y 轴的平移。

[in] cumulativeScale

自操作开始以来,比例变化为原始大小的百分比。

[in] cumulativeExpansion

自用户定义坐标中的操作开始以来,扩展更改。

[in] cumulativeRotation

自操作开始以来,旋转变化,以弧度为单位。

返回值

如果该方法成功,则它会返回 S_OK。 如果失败,则返回 HRESULT 错误代码。

注解

操作事件是为 IInertiaProcessorIManipulationProcessor 接口生成的。 如果在对 ProcessMove 的调用中使用 TOUCHINPUT 结构中的值,则坐标将以百分之一像素为单位。

注意 使用惯性时,对 IInertiaProcessor::Complete 的调用可以强制推断当前操作,从而导致将较大的增量传递到 ManipulationCompleted 事件。 若要解决此问题,除了增量事件外,还对已完成的事件执行更新。
 

示例

以下代码演示 ManipulationDelta 方法的实现。

HRESULT STDMETHODCALLTYPE CManipulationEventSink::ManipulationDelta( 
    /* [in] */ FLOAT x,
    /* [in] */ FLOAT y,
    /* [in] */ FLOAT translationDeltaX,
    /* [in] */ FLOAT translationDeltaY,
    /* [in] */ FLOAT scaleDelta,
    /* [in] */ FLOAT expansionDelta,
    /* [in] */ FLOAT rotationDelta,
    /* [in] */ FLOAT cumulativeTranslationX,
    /* [in] */ FLOAT cumulativeTranslationY,
    /* [in] */ FLOAT cumulativeScale,
    /* [in] */ FLOAT cumulativeExpansion,
    /* [in] */ FLOAT cumulativeRotation)
{
    m_cDeltaEventCount ++;

    // Place your code handler here to do any operations based on the manipulation.

    return S_OK;
}    
    

要求

要求
最低受支持的客户端 Windows 7 [仅限桌面应用]
最低受支持的服务器 Windows Server 2008 R2 [仅限桌面应用]
目标平台 Windows
标头 manipulations.h (包括 Manipulations.h)

另请参阅

向非托管代码添加操作支持

处理非托管代码中的惯性

方法

_IManipulationEvents