Delphi XE 之路(6)手势操作

来源:互联网 发布:软件代理协议范本 编辑:程序博客网 时间:2024/05/17 22:01
 1.在窗体上使用并放置一个TGestures控件是必需的
2.如果要操作控件,并使按件能支持手势操作,还要进行一些相应的设置才能使用
3.Delphi-XE5-手势操作-Gestures-使用方法Delphi-XE5-手势操作-Gestures-使用方法Delphi-XE5-手势操作-Gestures-使用方法Delphi-XE5-手势操作-Gestures-使用方法
本经人试验(由于这玩意开发太慢,没办法一个个试出来,要好久的),主窗体的Touch下的GestureManager属性要指定TGestures控件,然后在Gestures下的Standard属性下要选中相应的动作,比如:
Left:从右到左划动
Right:从左到右划动
Up:从下到上划动
Down:从上到下划动
UpLeft:从下到上左
UpRight:从下到上右
剩下的你自己可以理解了..........
这里建议你只选你要的动作,不要什么动作都支持,那样的结果只会导致你的程序变的巨慢
这里还有一个属性集:
Delphi-XE5-手势操作-Gestures-使用方法
InterActiveGestures:交互手势
igZoom:选择为True后可以支持放大缩小功能
igPan:百度翻译为锅Delphi-XE5-手势操作-Gestures-使用方法应该是支持画圆等操作(这个等我证实后再更正)
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);

EnumSymbolsgLeftimage:64GestLeft.gifsgRightimage:64GestRight.gifsgUpimage:64GestUp.gifsgDownimage:64GestDown.gifsgUpLeftimage:64GestUpLeft.gifsgUpRightimage:64GestUpRight.gifsgDownLeftimage:64GestDownLeft.gifsgDownRightimage:64GestDownRight.gifsgLeftUpimage:64GestLeftUp.gifsgLeftDownimage:64GestLeftDown.gifsgRightUpimage:64GestRightUp.gifsgRightDownimage:64GestRightDown.gifsgUpDownimage:64GestUpDown.gifsgDownUpimage:64GestDownUp.gifsgLeftRightimage:64GestLeftRight.gifsgRightLeftimage:64GestRightLeft.gifsgUpLeftLongimage:64GestUpLeftLong.gifsgUpRightLongimage:64GestUpRightLong.gifsgDownLeftLongimage:64GestDownLeftLong.gifsgDownRightLongimage:64GestDownRightLong.gifsgScratchoutimage:64GestScratchOut.gifsgTriangleimage:64GestTriangle.gifsgSquareimage:64GestSquare.gifsgCheckimage:64GestCheck.gifsgCurlicueimage:64GestCurlicue.gifsgDoubleCurlicueimage:64GestDoubleCurlicue.gifsgCircleimage:64GestCircle.gifsgDoubleCircleimage:64GestDoubleCircle.gifsgSemiCircleLeftimage:64GestSemiCircleLeft.gifsgSemiCircleRightimage:64GestSemiCircleRight.gifsgChevronUpimage:64GestChevronUp.gifsgChevronDownimage:64GestChevronDown.gifsgChevronLeftimage:64GestChevronLeft.gifsgChevronRightimage:64GestChevronRight.gif
0 0