Browse Source

解决触摸不灵敏的问题。

master
yibo 6 years ago
parent
commit
4d7c0f75ab
1 changed files with 43 additions and 0 deletions
  1. +43
    -0
      B3DealerClient/App.xaml.cs

+ 43
- 0
B3DealerClient/App.xaml.cs View File

@ -1,11 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; using System.Configuration;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Input;
namespace B3DealerClient namespace B3DealerClient
{ {
@ -57,6 +60,46 @@ namespace B3DealerClient
if (!System.IO.Directory.Exists(folder)) if (!System.IO.Directory.Exists(folder))
System.IO.Directory.CreateDirectory(folder); System.IO.Directory.CreateDirectory(folder);
} }
DisableWPFTabletSupport();
}
public static void DisableWPFTabletSupport()
{
// Get a collection of the tablet devices for this window.
TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;
if (devices.Count > 0)
{
// Get the Type of InputManager.
Type inputManagerType = typeof(System.Windows.Input.InputManager);
// Call the StylusLogic method on the InputManager.Current instance.
object stylusLogic = inputManagerType.InvokeMember("StylusLogic",
BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
null, InputManager.Current, null);
if (stylusLogic != null)
{
// Get the type of the device class.
Type devicesType = devices.GetType();
// Loop until there are no more devices to remove.
int count = devices.Count + 1;
while (devices.Count > 0)
{
// Remove the first tablet device in the devices collection.
devicesType.InvokeMember("HandleTabletRemoved", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, devices, new object[] { (uint)0 });
count--;
if (devices.Count != count)
{
throw new Win32Exception("Unable to remove real-time stylus support.");
}
}
}
}
} }
} }
} }

Loading…
Cancel
Save