diff --git a/ShareX.ScreenCaptureLib/RegionHelpers/AreaManager.cs b/ShareX.ScreenCaptureLib/RegionHelpers/AreaManager.cs index 077ad0a67..4a411dd0a 100644 --- a/ShareX.ScreenCaptureLib/RegionHelpers/AreaManager.cs +++ b/ShareX.ScreenCaptureLib/RegionHelpers/AreaManager.cs @@ -126,8 +126,7 @@ public bool IsResizing public bool IncludeControls { get; set; } public int MinimumSize { get; set; } = 3; - public float RoundedRectangleRadius { get; set; } = 15; - public int RoundedRectangleRadiusIncrement { get; set; } = 3; + public int RoundedRectangleRadiusIncrement { get; } = 3; private RectangleRegionForm surface; private SurfaceOptions config; @@ -399,7 +398,7 @@ private void surface_KeyDown(object sender, KeyEventArgs e) { case ShapeType.RegionRoundedRectangle: case ShapeType.DrawingRoundedRectangle: - RoundedRectangleRadius += RoundedRectangleRadiusIncrement; + config.RoundedRectangleRadius += RoundedRectangleRadiusIncrement; UpdateShape(); break; } @@ -409,7 +408,7 @@ private void surface_KeyDown(object sender, KeyEventArgs e) { case ShapeType.RegionRoundedRectangle: case ShapeType.DrawingRoundedRectangle: - RoundedRectangleRadius = Math.Max(0, RoundedRectangleRadius - RoundedRectangleRadiusIncrement); + config.RoundedRectangleRadius = Math.Max(0, config.RoundedRectangleRadius - RoundedRectangleRadiusIncrement); UpdateShape(); break; } @@ -420,7 +419,7 @@ private void surface_KeyDown(object sender, KeyEventArgs e) private void ChangeCurrentShapeType(ShapeType shapeType) { CurrentShapeType = shapeType; - //config.CurrentShapeType = shapeType; + config.CurrentShapeType = CurrentShapeType; DeselectArea(); } @@ -654,10 +653,7 @@ public BaseShape CreateRegionShape(Rectangle rect) shape = new RectangleRegionShape(); break; case ShapeType.RegionRoundedRectangle: - shape = new RoundedRectangleRegionShape() - { - Radius = RoundedRectangleRadius - }; + shape = new RoundedRectangleRegionShape(); break; case ShapeType.RegionEllipse: shape = new EllipseRegionShape(); @@ -666,20 +662,17 @@ public BaseShape CreateRegionShape(Rectangle rect) shape = new RectangleDrawingShape(); break; case ShapeType.DrawingRoundedRectangle: - shape = new RoundedRectangleDrawingShape() - { - Radius = RoundedRectangleRadius - }; + shape = new RoundedRectangleDrawingShape(); break; case ShapeType.DrawingEllipse: shape = new EllipseDrawingShape(); break; - case ShapeType.DrawingArrow: - shape = new ArrowDrawingShape(); - break; case ShapeType.DrawingLine: shape = new LineDrawingShape(); break; + case ShapeType.DrawingArrow: + shape = new ArrowDrawingShape(); + break; } shape.Rectangle = rect; @@ -709,7 +702,7 @@ private void UpdateShape(BaseShape shape) if (shape is IRoundedRectangleShape) { IRoundedRectangleShape roundedRectangleShape = (IRoundedRectangleShape)shape; - roundedRectangleShape.Radius = RoundedRectangleRadius; + roundedRectangleShape.Radius = config.RoundedRectangleRadius; } } } diff --git a/ShareX.ScreenCaptureLib/SurfaceOptions.cs b/ShareX.ScreenCaptureLib/SurfaceOptions.cs index 162f708a8..7fd45b0e4 100644 --- a/ShareX.ScreenCaptureLib/SurfaceOptions.cs +++ b/ShareX.ScreenCaptureLib/SurfaceOptions.cs @@ -110,6 +110,9 @@ public class SurfaceOptions [DefaultValue(typeof(Color), "0, 0, 0, 0")] public Color ShapeFillColor { get; set; } = Color.FromArgb(0, 0, 0, 0); + [DefaultValue(15)] + public float RoundedRectangleRadius { get; set; } = 15; + public SurfaceOptions() { this.ApplyDefaultPropertyValues();