zoukankan      html  css  js  c++  java
  • delphi 手势 识别 哈哈


    本例尝试在 OnGesture 事件中响应 sgLeft、sgRight 手势; 操作步骤:

    1、加 TGestureManager 控件如窗体: GestureManager1;

    2、设置窗体属性 Touch.GestureManager := GestureManager1; 

    3、添加窗体的 OnCreate 事件, 写: Touch.StandardGestures := [sgLeft, sgRight];

    4、添加窗体的 OnGesture 事件, 写响应代码.



    上面的步骤 3 的目的是指定准备要接受识别的动作, 这在设计时选定比较方便:



    测试代码:


    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, GestureMgr;
    
    type
      TForm1 = class(TForm)
        GestureManager1: TGestureManager;
        procedure FormCreate(Sender: TObject);
        procedure FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo;
          var Handled: Boolean);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Touch.StandardGestures := [sgLeft, sgRight];
    end;
    
    procedure TForm1.FormGesture(Sender: TObject;
      const EventInfo: TGestureEventInfo; var Handled: Boolean);
    begin
      case EventInfo.GestureID of
        sgiLeft  : ShowMessage('Left');
        sgiRight : ShowMessage('Right');
      end;
    end;
    
    end.
    delphi lazarus opengl 网页操作自动化, 图像分析破解,游戏开发
  • 相关阅读:
    函数 20140829
    结构体 20140827
    经典小游戏--推箱子
    更改版本与集合 20140826
    冒泡排序 20140823
    数组 20140822
    语句与字符串的属性及方法 20140820
    20141021WinForm控件属性
    20141014C#面向对象抽象方法,抽象类,接口
    20141011C#面向对象基础
  • 原文地址:https://www.cnblogs.com/delphi-xe5/p/5419776.html
Copyright © 2011-2022 走看看