zoukankan      html  css  js  c++  java
  • Delphi 2010 新增功能之: 手势编程[2] 通过 OnGesture 识别手势


    本例尝试在 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.
    
  • 相关阅读:
    十进制数转换
    桶排序
    快速排序
    单词倒排
    (c++) string b; cin>>b; int i=strlen(b); 报错的原因。
    n的阶乘(1<n<10000)(结果超大……)
    2020软件工程最后一次作业
    2020软件工程第四次作业
    2020软件工程第三次作业
    2020软件工程第二次作业
  • 原文地址:https://www.cnblogs.com/del/p/1587358.html
Copyright © 2011-2022 走看看