Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 KB | None | 0 0
  1. public static void DisableWPFTabletSupport()  
  2. {  
  3.     // Get a collection of the tablet devices for this window.    
  4.     TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;  
  5.  
  6.     if (devices.Count > 0)  
  7.     {    
  8.         // Get the Type of InputManager.  
  9.         Type inputManagerType = typeof(System.Windows.Input.InputManager);  
  10.  
  11.         // Call the StylusLogic method on the InputManager.Current instance.  
  12.         object stylusLogic = inputManagerType.InvokeMember("StylusLogic",  
  13.                     BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,  
  14.                     null, InputManager.Current, null);  
  15.  
  16.         if (stylusLogic != null)  
  17.         {  
  18.             //  Get the type of the stylusLogic returned from the call to StylusLogic.  
  19.             Type stylusLogicType = stylusLogic.GetType();  
  20.  
  21.             // Loop until there are no more devices to remove.  
  22.             while (devices.Count > 0)  
  23.             {  
  24.                 // Remove the first tablet device in the devices collection.  
  25.                 stylusLogicType.InvokeMember("OnTabletRemoved",  
  26.                         BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic,  
  27.                         null, stylusLogic, new object[] { (uint)0 });  
  28.             }                  
  29.         }  
  30.  
  31.     }  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement