一.运行条件:
WIN7系统,WIN7 SDK v7.0,VS2008
二.添加多点触摸代码:
(1)在***View.h中添加几个手势有关的数据成员和成员函数:
POINT _ptFirst; // first significant point of gesture
POINT _ptSecond; // second significant point of gesture
DWORD _dwID; // current ID
ULONGLONG _dwArguments; // this is holder for additional information about gesture event
注:以下函数都在***View.cpp中:
(2) 初始化InitGesture():
//初始化手势,以使窗口能响应手势事件
void ChdHomeMDIView::GST_InitGesture()
{
//初始化手势
GESTURECONFIG config = { 0 };
config.dwWant = GC_ROTATE;//支持旋转
config.dwID = GID_ROTATE;
config.dwBlock = 0;
SetGestureConfig(
GetSafeHwnd(),
0,
1,
&config,
sizeof(GESTURECONFIG)
);
config.dwID = GID_PAN;//支持单点鼠标移动,并且设置阻塞一个手指的单击并移动否则不能响应鼠标单击WM_LBUTTONDOWN