void Pointer_Clicked(object sender, PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint currentPoint = e.GetCurrentPoint(GridMain); Windows.UI.Input.PointerPointProperties pointerProperties = currentPoint.Properties; string temp = "none"; if (pointerProperties.IsLeftButtonPressed) { temp = "Left"; } if (pointerProperties.IsMiddleButtonPressed) { temp = "Scroll"; } if (pointerProperties.IsRightButtonPressed) { temp = "Right"; } spKeyboard.Children.Insert(0, (new TextBlock() { Foreground = new SolidColorBrush(Colors.Blue), Text = Convert.ToString($"{temp} Mouse Button Clicked at " + DateTime.Now.ToString("h:mm:ss fffffff")) })); }
internal PointerPointProperties(Windows.UI.Input.PointerPointProperties properties) { if (properties is null) { return; } IsPrimary = properties.IsPrimary; IsInRange = properties.IsInRange; IsLeftButtonPressed = properties.IsLeftButtonPressed; IsMiddleButtonPressed = properties.IsMiddleButtonPressed; IsRightButtonPressed = properties.IsRightButtonPressed; IsHorizontalMouseWheel = properties.IsHorizontalMouseWheel; IsXButton1Pressed = properties.IsXButton1Pressed; IsXButton2Pressed = properties.IsXButton2Pressed; IsBarrelButtonPressed = properties.IsBarrelButtonPressed; IsEraser = properties.IsEraser; Pressure = properties.Pressure; Orientation = properties.Orientation; ContactRect = properties.ContactRect; TouchConfidence = properties.TouchConfidence; IsCanceled = properties.IsCanceled; PointerUpdateKind = (PointerUpdateKind)properties.PointerUpdateKind; XTilt = properties.XTilt; YTilt = properties.YTilt; MouseWheelDelta = properties.MouseWheelDelta; }
// Return the properties that are specific to pen String GetPenProperties(Windows.UI.Input.PointerPoint currentPoint) { Windows.UI.Input.PointerPointProperties pointerProperties = currentPoint.Properties; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("Barrel button: " + pointerProperties.IsBarrelButtonPressed); sb.Append("\nEraser: " + pointerProperties.IsEraser); sb.Append("\nPressure: " + pointerProperties.Pressure); return(sb.ToString()); }
// Return the properties that are specific to touch String GetTouchProperties(Windows.UI.Input.PointerPoint currentPoint) { Windows.UI.Input.PointerPointProperties pointerProperties = currentPoint.Properties; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("Contact Rect X: " + pointerProperties.ContactRect.X); sb.Append("\nContact Rect Y: " + pointerProperties.ContactRect.Y); sb.Append("\nContact Rect Width: " + pointerProperties.ContactRect.Width); sb.Append("\nContact Rect Height: " + pointerProperties.ContactRect.Height); return(sb.ToString());; }
void Pointer_Wheel_Changed(object sender, PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint currentPoint = e.GetCurrentPoint(GridMain); Windows.UI.Input.PointerPointProperties pointerProperties = currentPoint.Properties; spScroll.Children.Insert(1, (new TextBlock() { Foreground = new SolidColorBrush(Colors.Yellow), Text = Convert.ToString($"Scroll={ScrollCnt}+{pointerProperties.MouseWheelDelta/120}={ScrollCnt+ pointerProperties.MouseWheelDelta / 120} at " + DateTime.Now.ToString("h:mm:ss fffffff")) })); ScrollCnt += pointerProperties.MouseWheelDelta / 120; scrollTbl.Text = $" ScrollCnt = {ScrollCnt}"; }
// Return the properties that are specific to mice String GetMouseProperties(Windows.UI.Input.PointerPoint currentPoint) { Windows.UI.Input.PointerPointProperties pointerProperties = currentPoint.Properties; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("Left button: " + pointerProperties.IsLeftButtonPressed); sb.Append("\nRight button: " + pointerProperties.IsRightButtonPressed); sb.Append("\nMiddle button: " + pointerProperties.IsMiddleButtonPressed); sb.Append("\nX1 button: " + pointerProperties.IsXButton1Pressed); sb.Append("\nX2 button: " + pointerProperties.IsXButton2Pressed); sb.Append("\nMouse wheel delta: " + pointerProperties.MouseWheelDelta); return(sb.ToString()); }
public UwpPointerPointProperties(Windows.UI.Input.PointerPointProperties properties) { this.properties = properties; }