Monday 15 February 2010

event handling - Handle tilt left / right in WPF -


How can I tweak left or tilt correct mouse events in WPF?

I find out how to apply WndProc in WPF UserControl. UserControl will receive a window pointer in my example by AppendWindow method:

  Private Static MyUserControl instanceWithFocus; Public Zero Upland Window (Window Window) {HwndSource Source = HwndSource.FromHwnd (New WindowInteropHelper (Window). Handle); Source Eidhook (new HDWSourceHook (WDPRC)); } Private Static IntPtr WndProc (IntPtr hwnd, integer message, IntPtr wParam, IntPtr lParam, ref handled bool) {Switch (MSG) {Case Win32Messages.WM_MOUSEHWHEEL: MouseWheelTilt (wParam, lParam); Handled = true; break; Default: Break; } Return IntPtr.Zero; } Private static zero MouseWheelTilt (IntPtr wParam, IntPtr lParam) {Int32 tilt = (int16) Utils.HIWORD (wParam); Int32 key = Utill. Talwar (WPAM); Int32 x = Util Sword (lParam); Int32 y = Utilis Ford (lParam); // If an event calls on the active example of this object, then (instanceWithFocus = null!) {InstanceWithFocus.MouseWheelTilt (tilt, keys, X, Y); }} Private Zero MouseWheelTilt (Int32 Tilt, Int32 Keys, Int32 X, Int32 Y) {scrollViewer.ScrollToHorizontalOffset (scrollViewer.HorizontalOffset + Tilt); } Private Zero User ControlMouse (Object Sender, MouseInventErgus E) {instanceWithFocus = this; } Private Zero User ControlMouse LEV (Object Sender, MouseInventErgus E) {instanceWithFocus = null; } Intangible class Win32Messages {public const int WM_MOUSEHWHEEL = 0x020E; } Abstract class Utils {Internal Static Int32 HIWORD (IntPtr ptr) {Int32 val32 = ptr.ToInt32 (); Return ((val32> & gt; 16) & amp; 0xFFFF); } Internal Fixed Ent 32 Lowered (Intit PTR) {Int32 val32 = ptr.ToInt32 (); Return (val32 and 0xFFFF); }}  

No comments:

Post a Comment