1.在窗体上使用并放置一个TGestures控件是必需的
2.如果要操作控件,并使按件能支持手势操作,还要进行一些相应的设置才能使用
本经人试验(由于这玩意开发太慢,没办法一个个试出来,要好久的),主窗体的Touch下的GestureManager属性要指定TGestures控件,然后在Gestures下的Standard属性下要选中相应的动作,比如:
Left:从右到左划动
Right:从左到右划动
Up:从下到上划动
Down:从上到下划动
UpLeft:从下到上左
UpRight:从下到上右
剩下的你自己可以理解了..........
这里建议你只选你要的动作,不要什么动作都支持,那样的结果只会导致你的程序变的巨慢
这里还有一个属性集:
igZoom:选择为True后可以支持放大缩小功能
igPan:百度翻译为锅应该是支持画圆等操作(这个等我证实后再更正)
igRotate:旋转
igTwoFingerTap:支持两个手指同时操作
igPressAndTap:新闻和水龙头(百度翻译)实际应该理解为手指划折线的支持(有待证实)
igLongTap:长的水龙头(百度翻译)实际理解为手指画长折线的支持(有待证实)
igDoubleTap:双击操作(字面理解,也没实践)
4.不支持动作的解决
可在窗体上放置一个标签用来显示动作值,即在窗体的onGesture事件中捕获EventInfo.GestureID的常量,通常从右往左手势的值为1,从左至右的手势值为2,如果能正确显示相应数值,基本上手势是在这个应用上被支持了,但至于你的手势是否被响应了,这要看你的代码了。
5.手势参考
Delphi 把可以识别的手势分成了 3 类: 标准手势、自定义手势、交互手势(InteractiveGestures).
其中的交互手势用鼠标不好模拟, 可能只能用于触摸屏;
Delphi 预定义了 34 种标准手势, 并定义成 TStandardGesture 枚举类型:
TStandardGesture = ( sgLeft = sgiLeft, sgRight = sgiRight, sgUp = sgiUp, sgDown = sgiDown, sgUpLeft = sgiUpLeft, sgUpRight = sgiUpRight, sgDownLeft = sgiDownLeft, sgDownRight = sgiDownRight, sgLeftUp = sgiLeftUp, sgLeftDown = sgiLeftDown, sgRightUp = sgiRightUp, sgRightDown = sgiRightDown, sgUpDown = sgiUpDown, sgDownUp = sgiDownUp, sgLeftRight = sgiLeftRight, sgRightLeft = sgiRightLeft, sgUpLeftLong = sgiUpLeftLong, sgUpRightLong = sgiUpRightLong, sgDownLeftLong = sgiDownLeftLong, sgDownRightLong = sgiDownRightLong, sgScratchout = sgiScratchout, sgTriangle = sgiTriangle, sgSquare = sgiSquare, sgCheck = sgiCheck, sgCurlicue = sgiCurlicue, sgDoubleCurlicue = sgiDoubleCurlicue, sgCircle = sgiCircle, sgDoubleCircle = sgiDoubleCircle, sgSemiCircleLeft = sgiSemiCircleLeft, sgSemiCircleRight = sgiSemiCircleRight, sgChevronUp = sgiChevronUp, sgChevronDown = sgiChevronDown, sgChevronLeft = sgiChevronLeft, sgChevronRight = sgiChevronRight);
其中的交互手势用鼠标不好模拟, 可能只能用于触摸屏;
Delphi 预定义了 34 种标准手势, 并定义成 TStandardGesture 枚举类型:
TStandardGesture = ( sgLeft = sgiLeft, sgRight = sgiRight, sgUp = sgiUp, sgDown = sgiDown, sgUpLeft = sgiUpLeft, sgUpRight = sgiUpRight, sgDownLeft = sgiDownLeft, sgDownRight = sgiDownRight, sgLeftUp = sgiLeftUp, sgLeftDown = sgiLeftDown, sgRightUp = sgiRightUp, sgRightDown = sgiRightDown, sgUpDown = sgiUpDown, sgDownUp = sgiDownUp, sgLeftRight = sgiLeftRight, sgRightLeft = sgiRightLeft, sgUpLeftLong = sgiUpLeftLong, sgUpRightLong = sgiUpRightLong, sgDownLeftLong = sgiDownLeftLong, sgDownRightLong = sgiDownRightLong, sgScratchout = sgiScratchout, sgTriangle = sgiTriangle, sgSquare = sgiSquare, sgCheck = sgiCheck, sgCurlicue = sgiCurlicue, sgDoubleCurlicue = sgiDoubleCurlicue, sgCircle = sgiCircle, sgDoubleCircle = sgiDoubleCircle, sgSemiCircleLeft = sgiSemiCircleLeft, sgSemiCircleRight = sgiSemiCircleRight, sgChevronUp = sgiChevronUp, sgChevronDown = sgiChevronDown, sgChevronLeft = sgiChevronLeft, sgChevronRight = sgiChevronRight);