diff --git a/InkCanvasForClass/Helpers/RectangleSelectionViewer.cs b/InkCanvasForClass/Helpers/RectangleSelectionViewer.cs
index 79e70dc..44f97d7 100644
--- a/InkCanvasForClass/Helpers/RectangleSelectionViewer.cs
+++ b/InkCanvasForClass/Helpers/RectangleSelectionViewer.cs
@@ -15,6 +15,7 @@ namespace Ink_Canvas.Helpers
private VisualCollection _children;
private DrawingVisual _layer = new DrawingVisual();
private Pen defaultPen = new Pen();
+ private Pen lassoPen = new Pen();
public RectangleSelectionViewer()
{
@@ -24,6 +25,13 @@ namespace Ink_Canvas.Helpers
defaultPen.Thickness = 2;
defaultPen.Brush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
defaultPen.DashStyle = DashStyles.Dash;
+
+ lassoPen.Thickness = 6;
+ lassoPen.Brush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
+ lassoPen.DashStyle = new DashStyle(new double[]{0,2},0);
+ lassoPen.DashCap = PenLineCap.Round;
+ lassoPen.StartLineCap = PenLineCap.Round;
+ lassoPen.EndLineCap = PenLineCap.Round;
}
protected override int VisualChildrenCount => _children.Count;
@@ -40,6 +48,25 @@ namespace Ink_Canvas.Helpers
context.Close();
}
+ public void DrawLassoLine(PointCollection pts) {
+ DrawingContext context = _layer.RenderOpen();
+ if (pts.Count > 2) {
+ StreamGeometry geometry = new StreamGeometry();
+ var _pts = pts.Clone();
+ _pts.RemoveAt(0);
+ using (StreamGeometryContext ctx = geometry.Open()) {
+ ctx.BeginFigure(pts[0], true , false);
+ ctx.PolyLineTo(_pts,true, true);
+ }
+ context.DrawGeometry(new SolidColorBrush(Colors.Transparent), lassoPen, geometry);
+ } else if (pts.Count == 2) {
+ context.DrawLine(defaultPen, pts[0], pts[1]);
+ } else if (pts.Count == 1) {
+ context.DrawLine(defaultPen, pts[0], pts[0]);
+ }
+ context.Close();
+ }
+
public void ClearDrawing() {
DrawingContext context = _layer.RenderOpen();
context.Close();
diff --git a/InkCanvasForClass/InkCanvasForClass.csproj b/InkCanvasForClass/InkCanvasForClass.csproj
index 6b9b6b6..10a855c 100644
--- a/InkCanvasForClass/InkCanvasForClass.csproj
+++ b/InkCanvasForClass/InkCanvasForClass.csproj
@@ -567,6 +567,7 @@
+
@@ -579,6 +580,7 @@
+
diff --git a/InkCanvasForClass/MainWindow.xaml b/InkCanvasForClass/MainWindow.xaml
index 8daff08..6a1075d 100644
--- a/InkCanvasForClass/MainWindow.xaml
+++ b/InkCanvasForClass/MainWindow.xaml
@@ -22,7 +22,7 @@
Closed="Window_Closed"
PreviewKeyDown="Main_Grid_PreviewKeyDown"
PreviewKeyUp="Main_Grid_PreviewKeyUp"
- Height="12000" Width="1440"
+ Height="18000" Width="1440"
FontFamily="Microsoft YaHei UI"
MouseWheel="Window_MouseWheel"
Foreground="Black"
@@ -6016,6 +6016,8 @@
StrokeThickness="1" Margin="0,4,0,4" />
+
@@ -6041,11 +6043,92 @@
-
+ SelectedIndex="0" SelectionChanged="ComboBoxSelectionMethod_SelectionChanged">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8416,6 +8499,22 @@
+
+
+
+
+
+
+
+
+