Ejemplo n.º 1
0
 /// <summary>
 /// 画矩形
 /// </summary>
 private void DrawSquare(Point endP)
 {
     try
     {
         List <Point> pointList = new List <Point>
         {
             new Point(startPoint.X, startPoint.Y),
             new Point(startPoint.X, endP.Y),
             new Point(endP.X, endP.Y),
             new Point(endP.X, startPoint.Y),
             new Point(startPoint.X, startPoint.Y),
         };
         StylusPointCollection point = new StylusPointCollection(pointList);
         if (stroke != null)
         {
             InkStrokes.Remove(stroke);
         }
         stroke = new Stroke(point)
         {
             DrawingAttributes = inkCanvasMeasure.DefaultDrawingAttributes.Clone()
         };
         InkStrokes.Add(stroke);
         point = null;
     }
     catch (Exception ex)
     {
         logger.Error($"DrawSquare:{ex.Message}");
     }
 }
Ejemplo n.º 2
0
 public void UndoBody()
 {
     if (InkStrokes.Count == 0)
     {
         return;
     }
     InkStrokes.RemoveAt(InkStrokes.Count - 1);
 }
Ejemplo n.º 3
0
 private void DrawPen(Point endP)
 {
     try
     {
         penCollection.Add(new StylusPoint(endP.X, endP.Y));
         if (stroke != null)
         {
             InkStrokes.Remove(stroke);
         }
         stroke = new Stroke(penCollection)
         {
             DrawingAttributes = inkCanvasMeasure.DefaultDrawingAttributes.Clone()
         };
         InkStrokes.Add(stroke);
     }
     catch (Exception ex)
     {
         logger.Error($"DrawEllipse:{ex.Message}");
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 画椭圆
 /// </summary>
 /// <param name="endP"></param>
 private void DrawEllipse(Point endP)
 {
     try
     {
         List <Point>          pointList = GenerateEclipseGeometry(startPoint, endP);
         StylusPointCollection point     = new StylusPointCollection(pointList);
         if (stroke != null)
         {
             InkStrokes.Remove(stroke);
         }
         stroke = new Stroke(point)
         {
             DrawingAttributes = inkCanvasMeasure.DefaultDrawingAttributes.Clone()
         };
         InkStrokes.Add(stroke);
         point = null;
     }
     catch (Exception ex)
     {
         logger.Error($"DrawEllipse:{ex.Message}");
     }
 }