public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { endPoint = e.GetPosition(inkCanvas); if (startPoint != endPoint) { StylusPointCollection pts = new StylusPointCollection(); GetLine(pts, (s) => { if (StrokeResult != null) { inkCanvas.Strokes.Remove(StrokeResult); } DrawingAttributes drawingAttributes = new DrawingAttributes { Color = inkCanvas.DefaultDrawingAttributes.Color, Width = inkCanvas.DefaultDrawingAttributes.Width, StylusTip = StylusTip.Ellipse, IgnorePressure = true, FitToCurve = true }; StrokeResult = new LineStroke(s, drawingAttributes); inkCanvas.Strokes.Add(StrokeResult); } ); } } }
public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { endPoint = e.GetPosition(inkCanvas); if(startPoint != endPoint) { StylusPointCollection pts = new StylusPointCollection(); GetLine(pts, (s) => { if (StrokeResult != null) inkCanvas.Strokes.Remove(StrokeResult); DrawingAttributes drawingAttributes = new DrawingAttributes { Color = inkCanvas.DefaultDrawingAttributes.Color, Width = inkCanvas.DefaultDrawingAttributes.Width, StylusTip = StylusTip.Ellipse, IgnorePressure = true, FitToCurve = true }; StrokeResult = new LineStroke(s, drawingAttributes); inkCanvas.Strokes.Add(StrokeResult); } ); } } }