_IManipulationEvents::ManipulationCompleted 方法 (manipulations.h)

处理操作或惯性完成时的事件。

语法

HRESULT ManipulationCompleted(
  [in] FLOAT x,
  [in] FLOAT y,
  [in] FLOAT cumulativeTranslationX,
  [in] FLOAT cumulativeTranslationY,
  [in] FLOAT cumulativeScale,
  [in] FLOAT cumulativeExpansion,
  [in] FLOAT cumulativeRotation
);

参数

[in] x

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

[in] y

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

[in] cumulativeTranslationX

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

[in] cumulativeTranslationY

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

[in] cumulativeScale

自操作开始以来,总缩放比例会随着原始大小的百分比而变化。

[in] cumulativeExpansion

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

[in] cumulativeRotation

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

返回值

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

注解

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

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

示例

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




HRESULT STDMETHODCALLTYPE CManipulationEventSink::ManipulationCompleted( 
    /* [in] */ FLOAT x,
    /* [in] */ FLOAT y,
    /* [in] */ FLOAT cumulativeTranslationX,
    /* [in] */ FLOAT cumulativeTranslationY,
    /* [in] */ FLOAT cumulativeScale,
    /* [in] */ FLOAT cumulativeExpansion,
    /* [in] */ FLOAT cumulativeRotation)
{
    m_cCompletedEventCount ++;

    m_fX = x;
    m_fY = y;
    m_fCumulativeTranslationX = cumulativeTranslationX;
    m_fCumulativeTranslationY = cumulativeTranslationY;
    m_fCumulativeScale = cumulativeScale;
    m_fCumulativeExpansion = cumulativeExpansion;
    m_fCumulativeRotation = cumulativeRotation;

    // 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