• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

delphi触摸手势

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

delphi手势,左右滑动,

控件的OnGesture事件写代码。

放一个TGestureManager控件,设置控件的touch属性为TGestureManager控件。

然后勾选控件的Touch>Gestures>Standard>里的手势类型,left,right,up,down等等,然后在OnGesture事件就可以捕捉到了。

 

官方的手势图

http://docwiki.embarcadero.com/RADStudio/Berlin/en/TStandardGesture_Enum

 

Field Description

GestureID

The ID of the gesture that is emitted. ID is an integer value uniquely identifying the gesture.

Location

The current point on the control's surface. Location contains the X and Y coordinates of the last known point.

Flags

A set of TInteractiveGestureFlag options describing the state of the interactive gesture. Flags is only valid if the gesture is interactive.

Angle

The angle in radians (rad) in which either the finger or a gesturing device has moved relative to the screen coordinates.

Angle is only set for the rotation gesture (TInteractiveGesture = Rotate):

  • Angle is negative if rotation is clockwise.
  • Angle is positive if rotation is counter-clockwise.

Distance

The distance in pixels from the current point, given by Location, and the previous point.

Distance is only set for the zoom and two finger tap gestures (TInteractiveGesture = Zoom or TwoFingerTap). Distance is the distance between the two fingers or gesturing devices that are making the gesture.

InertiaVector

The inertia speed given by an X and Y pair. A positive X value means inertia toward the right of the screen, while a negative value means inertia to the left. A positive Y value means inertia toward the bottom of the screen, while a negative value means inertia to the top. InertiaVector is only valid if the event is interactive.

TapLocation

Specifies the coordinates of the "tap" and "press and tap" (igPressAndTap) gestures.

procedure TForm1.GridPanelLayout1Gesture(Sender: TObject;
  const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
  case EventInfo.GestureID of
    sgiRight://向右滑动
      begin

      end;
  end;
end;

 

case EventInfo.GestureID of
    sgiLeft:
      begin
        if TabControl1.ActiveTab <> TabControl1.Tabs[TabControl1.TabCount - 1] then
          TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex + 1];
        Handled := True;
      end;

    sgiRight:
      begin
        if TabControl1.ActiveTab <> TabControl1.Tabs[0] then
          TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex - 1];
        Handled := True;
      end;
  end;

 

返回键

procedure TTabbedwithNavigationForm.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
begin
  if Key = vkHardwareBack then
  begin
    if (TabControl1.ActiveTab = TabItem1) and (TabControl2.ActiveTab = TabItem6) then
    begin
      TabControl2.Previous;
      Key := 0;
    end;
  end;

 

touch与mouseup事件,先出发mouseUp事件,然后才触发ontouch事件。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
DELPHI控件:DBLookupComboBOX组件的使用方法发布时间:2022-07-18
下一篇:
Delphi中的窗体创建与销毁发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap