protected override void OnStylusUp(StylusEventArgs e) { if (stylusPoints == null) { stylusPoints = new StylusPointCollection(); } StylusPointCollection newStylusPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(newStylusPoints); Stroke3D stroke = new Stroke3D(stylusPoints); if (inPlugins.Contains(customrenderer)) { stroke.AddPropertyData(guidUsingCustomRenderer, 1); } if (inPlugins.Contains(dynamicRenderer)) { stroke.AddPropertyData(guidUsingStandardRenderer, 1); } ip.Strokes.Add(stroke); stylusPoints = null; Stylus.Capture(null); }
//</Snippet8> //<Snippet10> protected override void OnStylusUp(StylusEventArgs e) { if (stylusPoints == null) { return; } // Add the StylusPoints that have come in since the // last call to OnStylusMove. StylusPointCollection newStylusPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(newStylusPoints); // Create a new stroke from all the StylusPoints since OnStylusDown. Stroke stroke = new Stroke(stylusPoints); // Add the new stroke to the Strokes collection of the InkPresenter. ip.Strokes.Add(stroke); // Clear the StylusPointsCollection. stylusPoints = null; // Release stylus capture. Stylus.Capture(null); }
private void TouchFeedbackStatus(bool enable) { Stylus.SetIsTouchFeedbackEnabled(this, enable); Stylus.SetIsTapFeedbackEnabled(this, enable); Stylus.SetIsPressAndHoldEnabled(this, enable); Cursor = enable ? Cursors.Arrow : Cursors.None; }
//</Snippet24> //<Snippet25> void SynchronizeStylus() { Stylus.Synchronize(); UIElement element = (UIElement)Stylus.DirectlyOver; output.Text += "The stylus is over " + element.ToString() + "\r\n"; }
protected override void OnStylusUp(StylusEventArgs e) { // Allocate memory for the StylusPointsCollection, if necessary if (stylusPoints == null) { stylusPoints = new StylusPointCollection(); } // Add the StylusPoints that have come in since the last call to OnStylusMove StylusPointCollection newStylusPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(newStylusPoints); // Create a new custom stroke from all the StylusPoints since OnStylusDown //Stroke3D stroke = new Stroke3D(stylusPoints); Stroke stroke = new Stroke(stylusPoints, currentAttributes.Clone()); // Add the new stroke to the Strokes collection of the InkPresenter inkPresenter1.Strokes.Add(stroke); // Clear out the StylusPointsCollection stylusPoints = null; // Release stylus capture Stylus.Capture(null); }
public Window1() : base() { InitializeComponent(); inkCanvas1.StylusSystemGesture += new StylusSystemGestureEventHandler(inkCanvas1_StylusSystemGesture); //<Snippet2> Stylus.SetIsFlicksEnabled(canvas1, false); //</Snippet2> //<Snippet4> Stylus.SetIsTapFeedbackEnabled(canvas1, false); //</Snippet4> //<Snippet5> bool tapFeedbackEnabled = Stylus.GetIsTapFeedbackEnabled(canvas1); //</Snippet5> //<Snippet6> bool flicksEnabled = Stylus.GetIsFlicksEnabled(canvas1); //</Snippet6> canvas1.StylusSystemGesture += new StylusSystemGestureEventHandler(canvas1_StylusSystemGesture); }
protected override void OnStylusDown(StylusDownEventArgs e) { base.OnStylusDown(e); // TJC: only take in stylus ink, not multitouch bool isStylus = e.StylusDevice.Id == MyRend.STYLUS_ID || e.StylusDevice.StylusButtons.Count == 2; // tip and barrel if (!isStylus) { _touchCount++; if (_touchCount > _maxTouches) { _maxTouches = _touchCount; } //System.Console.WriteLine("DOWN TC: " + _touchCount + " " + _maxTouches); //if (_touchCount > 0) return; // don't capture ink if more than one touch // TJC TEST } if (InkEnabled) { _stylusPoints = new StylusPointCollection(); // Capture the stylus so all stylus input is routed to this control. Stylus.Capture(this); _stylusPoints.Add(e.GetStylusPoints(this, _stylusPoints.Description)); } }
protected override void OnStylusDown(StylusDownEventArgs e) { Stylus.Capture(this); StylusPointCollection newStylusPoints = e.GetStylusPoints(this); stylusPoints = new StylusPointCollection(newStylusPoints.Description); stylusPoints.Add(newStylusPoints); }
//</snippet10> private void PressAndHoldSnippets() { //<Snippet9> if (!Stylus.GetIsPressAndHoldEnabled(horizontalSlider1)) { Stylus.SetIsPressAndHoldEnabled(horizontalSlider1, true); } //</Snippet9> }
private void text_StylusUp(object sender, StylusEventArgs e) { Text txt = (Text)sender; Stylus.Capture(txt, CaptureMode.None); int xrel, yrel; e.GetPosition(txt, out xrel, out yrel); txt.TextContent = "Up, screen={" + e.X + "," + e.Y + "}, relative={" + xrel + "," + yrel + "}"; }
private void TouchFeedbackSnippets() { //<Snippet8> Stylus.SetIsTouchFeedbackEnabled(inkCanvas1, true); //</Snippet8> //<Snippet7> bool touchFeedbackEnabled = Stylus.GetIsTouchFeedbackEnabled(inkCanvas1); //</Snippet7> }
/// <summary> /// Handles the touch down event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> #if MF_FRAMEWORK_VERSION_V3_0 protected void Text_StylusDown(object sender, StylusEventArgs e) { int x; int y; e.GetPosition((UIElement)sender, out x, out y); #else void Text_TouchDown(object sender, TouchEventArgs e) { int x; int y; e.GetPosition((UIElement)sender, 0, out x, out y); #endif Text text = (Text)sender; // If we have already captured the touch, show the point. #if MF_FRAMEWORK_VERSION_V3_0 if (sender == Stylus.Captured) #else if (sender == TouchCapture.Captured) #endif { // If the user tapped inside the same control that has the // touch captured, release the capture. if ((x >= 0) && (y >= 0) && (x <= text.ActualWidth) && (y <= text.ActualHeight)) { #if MF_FRAMEWORK_VERSION_V3_0 Stylus.Capture(text, CaptureMode.None); #else TouchCapture.Capture(text, CaptureMode.None); #endif text.ForeColor = ColorUtility.ColorFromRGB(0, 0, 0); text.TextContent = "Capture Released."; } // Else, show the point as captured. else { text.TextContent = "Captured. Tap to toggle. Down at (" + x + "," + y + ")"; } } // Else, show the point as captured. else { text.ForeColor = ColorUtility.ColorFromRGB(255, 0, 0); text.TextContent = "Captured. Tap to toggle. Down at (" + x + "," + y + ")"; #if MF_FRAMEWORK_VERSION_V3_0 Stylus.Capture(text); #else TouchCapture.Capture(text); #endif } }
private void Pad01_StylusDown(object sender, StylusDownEventArgs e) { Stylus.Capture(Pad01); Point pos = e.GetPosition(Pad01); dPadPointX = Pad01.RenderSize.Width / 2; dPadPointY = Pad01.RenderSize.Height / 2; dStartPointX = pos.X - dPadPointX; dStartPointY = pos.Y - dPadPointY; flg = true; }
//<Snippet7> protected override void OnStylusDown(StylusDownEventArgs e) { // Capture the stylus so all stylus input is routed to this control. Stylus.Capture(this); // Allocate memory for the StylusPointsCollection and // add the StylusPoints that have come in so far. stylusPoints = new StylusPointCollection(); StylusPointCollection eventPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(eventPoints); }
//</Snippet10> // When the user lifts the stylus, create a Stroke from the // collected stylus points and add it to the InkPresenter. // When the control is selecting strokes, add the // point data to the IncrementalHitTester. protected override void OnStylusUp(StylusEventArgs e) { stylusPoints ??= new StylusPointCollection(); StylusPointCollection collectedPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(collectedPoints); AddPointsToHitTester(collectedPoints); AddStrokeToPresenter(); stylusPoints = null; Stylus.Capture(null); }
public void StartDrawing(StylusDevice stylus) { if (stylus != null && stylus.InAir) { return; } _dynamicRenderer.Reset(stylus, _stylusPoints); _dynamicRenderer.Enabled = true; _dynamicRenderer.DrawingAttributes.Color = Colors.Black; // Capture the stylus so all stylus input is routed to this control. Stylus.Capture(this); _stylusPoints = new StylusPointCollection(); }
private UserControl CreateUserStoryControl(UserStory userStory, int cptTop = 0) { GroupBox gbx = columns.Where(c => c.Tag == userStory.State).First(); //Create userStory frame TextBlock content = new TextBlock { Text = userStory.ToString(), TextWrapping = TextWrapping.Wrap }; UserControl userControl = new UserControl { Content = content, Tag = userStory, Height = 50, Width = gbx.Width - 20, BorderBrush = Brushes.Black, Cursor = Cursors.Hand }; // Set background color by limit date if (userStory.DateLimit != null) { if (DateTime.Now > userStory.DateLimit) { userControl.Background = Brushes.LightBlue; } else { userControl.Background = Brushes.LightPink; } } else { userControl.Background = Brushes.LightGray; } userControl.MouseDoubleClick += UsrCtrlUserStory_Click; userControl.TouchUp += UsrCtrlUserStory_Click; //Events for drag'n'drop userControl.PreviewTouchDown += UserStory_PreviewTouchDown; Stylus.SetIsPressAndHoldEnabled(userControl, false); //Add to lists, positionning and return cnvsSprint.Children.Add(userControl); Canvas.SetLeft(userControl, Canvas.GetLeft(gbx) + 10); Canvas.SetTop(userControl, Canvas.GetTop(gbx) + 30 + 60 * cptTop); userStories.Add(userControl); return(userControl); }
private void FirstTouchPad(Image TargetButton) { MouseDevice myStylusDevice = Mouse.PrimaryDevice; Stylus.Capture(TargetButton); Point pos = myStylusDevice.GetPosition(TargetButton); Stylus.Capture(Pad01); dPadPointX = Pad01.RenderSize.Width / 2; dPadPointY = Pad01.RenderSize.Height / 2; dStartPointX = pos.X - dPadPointX; dStartPointY = pos.Y - dPadPointY; flg = true; }
// Prepare to collect stylus packets. If Mode is set to Select, // get the IncrementalHitTester from the InkPresenter'newStroke // StrokeCollection and subscribe to its StrokeHitChanged event. protected override void OnStylusDown(StylusDownEventArgs e) { base.OnStylusDown(e); Stylus.Capture(this); // Create a new StylusPointCollection using the StylusPointDescription // from the stylus points in the StylusDownEventArgs. stylusPoints = new StylusPointCollection(); StylusPointCollection eventPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(eventPoints); InitializeHitTester(eventPoints); }
protected override void OnTouchDown(TouchEventArgs e) #endif { // Flag for the drawing state. _pressed = true; #if MF_FRAMEWORK_VERSION_V3_0 Stylus.Capture(this); #else TouchCapture.Capture(this); #endif // Trigger a redraw. Invalidate(); }
public AwesomeButton() { InitializeComponent(); Stylus.SetIsPressAndHoldEnabled(this, false); Stylus.SetIsFlicksEnabled(this, false); this.MouseEnter += AwesomeButton_MouseEnter; this.MouseLeave += AwesomeButton_MouseLeave; this.PreviewMouseDown += AwesomeButton_PreviewMouseDown; this.PreviewMouseUp += AwesomeButton_PreviewMouseUp; this.TouchDown += AwesomeButton_TouchDown; this.TouchUp += AwesomeButton_TouchUp; this.Loaded += AwesomeButton_Loaded; }
private void ButtonFake_StylusDown(Image TargetButton, FrickData fd, StylusDownEventArgs e) { Stylus.Capture(TargetButton); Point pos = e.GetPosition(TargetButton); dStartPointX = pos.X; dStartPointY = pos.Y; FrickPopImage.Source = PopImageC; PopTextC.Text = fd.PopText[0]; PopTextU.Text = fd.PopText[1]; PopTextD.Text = fd.PopText[2]; PopTextL.Text = fd.PopText[3]; PopTextR.Text = fd.PopText[4]; FrickPop.PlacementTarget = TargetButton; FrickPop.IsOpen = true; }
private void ButtonFake_StylusDown(object sender, StylusDownEventArgs e) { Stylus.Capture((Image)sender); Point pos = e.GetPosition((Image)sender); dStartPointX = pos.X; dStartPointY = pos.Y; int id = fblist.FindIndex(delegate(Image im) { return(sender.Equals(im)); }); FrickPopImage.Source = PopImageC; PopTextC.Text = fd[id].PopText[0]; PopTextU.Text = fd[id].PopText[1]; PopTextD.Text = fd[id].PopText[2]; PopTextL.Text = fd[id].PopText[3]; PopTextR.Text = fd[id].PopText[4]; FrickPop.PlacementTarget = (Image)sender; FrickPop.IsOpen = true; }
/// <summary> ///アクティブなソフトによってはスタイラスイベントが発生しない場合があるので ///ウィンドウメッセージを拾ってこっちを呼び出す /// </summary> /// <param name="TargetButton">処理対象偽ボタンコントロール</param> private void FirstTouch(Image TargetButton, FrickData fd) { MouseDevice myStylusDevice = Mouse.PrimaryDevice; Stylus.Capture(TargetButton); Point pos = myStylusDevice.GetPosition(TargetButton); dStartPointX = pos.X; dStartPointY = pos.Y; FrickPopImage.Source = PopImageC; PopTextC.Text = fd.PopText[0]; PopTextU.Text = fd.PopText[1]; PopTextD.Text = fd.PopText[2]; PopTextL.Text = fd.PopText[3]; PopTextR.Text = fd.PopText[4]; FrickPop.PlacementTarget = TargetButton; FrickPop.IsOpen = true; }
private void DrawingCanvas_StylusUp(object sender, StylusEventArgs e) { if (stylusPoints == null) { return; } StylusPointCollection newStylusPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(newStylusPoints); Stroke stroke = new Stroke(stylusPoints); stylusPoints = null; Stylus.Capture(null); }
public override void Perform() { int option = OptionIndex % 2; switch (option) { case 1: Stylus.Capture(InkCanvas); break; case 2: if (InkCanvas.Children.Count > 0) { int indexToCapture = Index % InkCanvas.Children.Count; Stylus.Capture(InkCanvas.Children[indexToCapture]); } break; } }
protected override void OnStylusDown(StylusDownEventArgs e) { Stylus.Capture(this); //Get the StylusPoints that have come in so far StylusPointCollection newStylusPoints = e.GetStylusPoints(this); // Allocate memory for the StylusPointsCollection and // add the StylusPoints that have come in so far //stylusPoints = new StylusPointCollection(newStylusPoints.Description); //stylusPoints.Add(newStylusPoints); //Create a new StylusPointCollection using the StylusPointDescription //from the stylus points in the StylusDownEventArgs. stylusPoints = new StylusPointCollection(); StylusPointCollection eventPoints = e.GetStylusPoints(this, stylusPoints.Description); stylusPoints.Add(eventPoints); }
protected override void OnTouchUp(TouchEventArgs e) #endif { // Flag for the drawing state. _pressed = false; #if MF_FRAMEWORK_VERSION_V3_0 Stylus.Capture(this, CaptureMode.None); #else TouchCapture.Capture(this, CaptureMode.None); #endif // Trigger a redraw. Invalidate(); // Fire a click event. EventArgs args = new EventArgs(); OnClick(args); }
public MainWindow() { InitializeComponent(); if (System.Windows.Forms.Screen.AllScreens.Length >= 2) { screen0 = System.Windows.Forms.Screen.AllScreens[0].Bounds; screen1 = System.Windows.Forms.Screen.AllScreens[1].Bounds; STATICS.SCREEN_WIDTH = screen0.Width; STATICS.SCREEN_HEIGHT = screen0.Height; STATICS.SCREEN_NUM = 2; System.Drawing.Rectangle screenBounds = System.Windows.Forms.Screen.AllScreens[0].Bounds; this.Left = screenBounds.Left; this.Top = screenBounds.Top; InitializeCloudView(); } else { STATICS.SCREEN_WIDTH = (int)SystemParameters.PrimaryScreenWidth; STATICS.SCREEN_HEIGHT = (int)SystemParameters.PrimaryScreenHeight; STATICS.SCREEN_NUM = 1; //STATICS.DEAULT_CARD_SIZE = new Size(0.08333 * STATICS.SCREEN_WIDTH, 0.11111 * STATICS.SCREEN_HEIGHT); //STATICS.DEAULT_CARD_SIZE_WITH_BORDER = new Size(0.08333 * STATICS.SCREEN_WIDTH + 5, 0.11111 * STATICS.SCREEN_HEIGHT + 5); this.Width = STATICS.SCREEN_WIDTH; this.Height = STATICS.SCREEN_HEIGHT; this.WindowState = System.Windows.WindowState.Maximized; this.Left = 0; } boundary = new Rect(0, 0, STATICS.SCREEN_WIDTH, STATICS.SCREEN_HEIGHT); Stylus.SetIsPressAndHoldEnabled(this, false); Stylus.SetIsTapFeedbackEnabled(this, false); Stylus.SetIsFlicksEnabled(this, false); Stylus.SetIsTouchFeedbackEnabled(this, false); this.Loaded += Window_Loaded; Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 28 }); controlWindow = new Control_Window(this); controlWindow.Show(); this.Visibility = Visibility.Hidden; this.KeyDown += MainWindow_KeyDown; }
protected override void OnStylusUp(StylusEventArgs e) { base.OnStylusUp(e); // TJC: only take in stylus ink, not multitouch bool isStylus = e.StylusDevice.Id == MyRend.STYLUS_ID || e.StylusDevice.StylusButtons.Count == 2; // tip and barrel if (!isStylus) { _touchCount--; //System.Console.WriteLine("UP TC: " + _touchCount + " " + _maxTouches); //if (_maxTouches > 0) return; // TJC: test // reset max touch once we hit 0 if (_touchCount <= 0) { _maxTouches = 0; } } // Release stylus capture. if (Stylus.Captured == this) // bcz: uncapturing the stylus will uncapture the mouse. However, widgets like SelectionFeedback may have Captured just the Mouse and won't get their Up events - so don't uncapture unless the captured object is 'this' { Stylus.Capture(null); } if (_stylusPoints == null) { return; } _stylusPoints.Add(e.GetStylusPoints(this, _stylusPoints.Description)); Stroke stroke = new Stroke(_stylusPoints); stroke.DrawingAttributes = _dynamicRenderer.DrawingAttributes.Clone(); Stroq s = new Stroq(stroke); if (KeepStroqs) { _stroqs.Add(s); } _stylusPoints = null; RaiseStroqCollectedEvent(s, !isStylus || e.StylusDevice.SwitchState(InqUtils.BarrelSwitch) == StylusButtonState.Down); }
public StylusState( Stylus stylus ) { Buttons = new bool[stylus.Buttons.Count]; var names = Enumerable.Range(0,Buttons.Length).Select(i=>stylus.Buttons.GetName(i)).ToList(); TipIndex = names.IndexOf(names.First(n=>n.Contains("Tip"))); BarrelIndex = names.IndexOf(names.First(n=>n.Contains("Barrel"))); }