2

Windows 7 マシンに接続された静電容量式タッチパネルからのジェスチャ入力を含む GUI に取り組んでいます。OS には Tablet PC サポート ドライバがインストールされており、それらが通信の唯一の手段である必要があります。

私の主なアプローチは、Microsoft.ink.dll 内で参照される InkCollector クラスを使用することです。これにより、探している動作を実装するのに十分な SystemGesture イベントにアクセスできます。

ここでの問題は、SystemGesture.Flick イベントの到着が非常に遅く、約 1 秒後に到着することです。フリックを認識するための処理が行われていることは理解していますが、それでもアイデアが使い物にならなくなります。

物事をスピードアップする方法のアイデアはありますか?

私の初期化コードは以下の通りです:

  public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InkCollector inkCollector = new InkCollector(this);
            inkCollector.CollectionMode = CollectionMode.GestureOnly;
            inkCollector.Enabled = true;

            inkCollector.SetGestureStatus(ApplicationGesture.AllGestures, true);

            inkCollector.SystemGesture += SystemGestureEventHandler;
            inkCollector.Gesture += GestureEventHandler;
        }

        public void SystemGestureEventHandler(object o, InkCollectorSystemGestureEventArgs args)
        {
            switch (args.Id)
            {
                case SystemGesture.Drag:
                    outputText.AppendText("Drag" + Environment.NewLine);
                    break;
                case SystemGesture.DoubleTap:
                    outputText.AppendText("DoubleTap"+ Environment.NewLine);
                    break;
                case SystemGesture.Flick:
                    outputText.AppendText("Flick"+ Environment.NewLine);
                    break;
                case SystemGesture.HoldEnter:
                    outputText.AppendText("HoldEnter"+ Environment.NewLine);
                    break;
                case SystemGesture.HoldLeave:
                    outputText.AppendText("HoldLeave" + Environment.NewLine);
                    break;
                case SystemGesture.Tap:
                    outputText.AppendText("Tap"+ Environment.NewLine);
                    break;
                default:
                        break;
            }
        }

    public void GestureEventHandler(object o, InkCollectorGestureEventArgs args)
        {
            foreach (Gesture gesture in args.Gestures)
            {
                switch (gesture.Id)
                {
                    case ApplicationGesture.ArrowDown:
                        outputText.AppendText("Gesture: Arrow Down"+ Environment.NewLine);
                        break;
                    case ApplicationGesture.ArrowUp:
                        outputText.AppendText("Gesture: Arrow Up" + Environment.NewLine);
                        break;
                    case ApplicationGesture.Down:
                        outputText.AppendText("Gesture: Down" + Environment.NewLine);
                        break;
                    case ApplicationGesture.Up:
                        outputText.AppendText("Gesture: Up" + Environment.NewLine);
                        break;
                    default:
                        break;
                }
            }
4

1 に答える 1

1

掘り下げた後、遅延は実際には意図的なものであり、ジェスチャーが認識されて完了するためのタイムアウトとして機能することがわかりました。残念ながら、このタイムアウトは変更できません ( https://msdn.microsoft.com/en-us/library/ms827533.aspxを参照)。

インク収集モードを次のように変更する必要がありました。

inkCollector.CollectionMode = CollectionMode.InkAndGesture;

コントロールへのインク レンダリングを無効にします。

inkCollector.DynamicRendering = false;
于 2015-02-24T18:16:16.707 に答える