c# - WPF: Is there a possibility to "route" ordinary mouse events to touch events in Windows 7 -
I am currently developing a touch screen application using WPF for C # (.NET 4.0) and Windows 7 I am My problem is that the currently available touch screen driver has generated only mouse events. (The manufacturer unfortunately does not provide a real Windows 7 driver) Therefore, I am currently not able to test properly.
Is there a general way to tell Windows 7 that a device must be a touch device (although it can provide only - one touch event)?
Check this out. . There is a mouse touchdivision CS file that looks like this. It converts events into manipulation of normal mouse events.
/// & lt; Summary & gt; /// is used to translate mouse events in touch events, to enable an integrated /// input processing pipeline. /// & lt; / Summary & gt; /// & lt; Comment & gt; This class originally comes from Blake. UI - http: //blakenui.codeplex.com< / Comments & gt; Public Class Mouth Touch Device: TouchDevice, ITeDevice {#region Class Member Private Static MouseTouch Device Device; Get public point position; Set; } #endriani department # public public statutes public static zero register event {root.PreviewMouseDown + = MouseDown; Root.PreviewMouseMove + = MouseMove; Root.PreviewMouseUp + = MouseUp; Root.LostMouseCapture + = LostMouseCapture; Root.MouseLeave + = mouse leve; } # Ndrian # area private static methods Private static zero mouseDown (object sender, mousebutton and arranger e) {if (device! = Null & amp; device .isactive) {device.ReportUp (); Device.Deactivate (); Device = null; } Device = new mouse track device (e.MouseDevice.GetHashCode ()); Device.SetActiveSource (e.MouseDevice.ActiveSource); Device. Post = E. Getpetin (faucet); Device.Activate (); Device.ReportDown (); } Private static wound memv (Object Sender, Mouse Avent Egase E) {if (device! = Null & amp; device .isactive) {device.position = e.GetPosition (null); Device.ReportMove (); }} Private Static Zero Mouse Up (Object Sender, MouseBuiltEventErgus E) {LostMusCapture (Sender, E); } Static Zero LostMouseCapture (Object Sender, MouseEventArgs E) {If (Device! = Tap & Device.Asactive) {device.Position = e.GetPosition (null); Device.ReportUp (); Device.Deactivate (); Device = null; }} Fixed zero mouse lev (object sender, mouse events Eg) {hostmaster copy (sender, e); } #partner # Regional Controller Public Mouse Touch Device (Intuit Device ID): Base (Device ID) {Status = New point (); } Methods imposed on # ndrian # area Public override touch point collection GetIntermediateTouchPoints (IInputElement relativeTo) {Return new TouchPointCollection (); } Public override touchpoint GetTouchPoint (IInputElement relativeTo) {point point = position; If (relative! = Zero) {point = this.ActiveSource.RootVisual.TransformToDescendant ((visible) relative). Transform (status); } Rect rect = new rect (dot, new size (1, 1)); Return a new Touch Point (this, point, rect, touchaction.move); } #endregion}
}
I hope you want this only.
Comments
Post a Comment