Remember rounded rectangle radius

This commit is contained in:
Jaex 2016-05-06 17:38:49 +03:00
parent 265a37fbd4
commit 3f78ffb972
2 changed files with 13 additions and 17 deletions

View file

@ -126,8 +126,7 @@ public bool IsResizing
public bool IncludeControls { get; set; } public bool IncludeControls { get; set; }
public int MinimumSize { get; set; } = 3; public int MinimumSize { get; set; } = 3;
public float RoundedRectangleRadius { get; set; } = 15; public int RoundedRectangleRadiusIncrement { get; } = 3;
public int RoundedRectangleRadiusIncrement { get; set; } = 3;
private RectangleRegionForm surface; private RectangleRegionForm surface;
private SurfaceOptions config; private SurfaceOptions config;
@ -399,7 +398,7 @@ private void surface_KeyDown(object sender, KeyEventArgs e)
{ {
case ShapeType.RegionRoundedRectangle: case ShapeType.RegionRoundedRectangle:
case ShapeType.DrawingRoundedRectangle: case ShapeType.DrawingRoundedRectangle:
RoundedRectangleRadius += RoundedRectangleRadiusIncrement; config.RoundedRectangleRadius += RoundedRectangleRadiusIncrement;
UpdateShape(); UpdateShape();
break; break;
} }
@ -409,7 +408,7 @@ private void surface_KeyDown(object sender, KeyEventArgs e)
{ {
case ShapeType.RegionRoundedRectangle: case ShapeType.RegionRoundedRectangle:
case ShapeType.DrawingRoundedRectangle: case ShapeType.DrawingRoundedRectangle:
RoundedRectangleRadius = Math.Max(0, RoundedRectangleRadius - RoundedRectangleRadiusIncrement); config.RoundedRectangleRadius = Math.Max(0, config.RoundedRectangleRadius - RoundedRectangleRadiusIncrement);
UpdateShape(); UpdateShape();
break; break;
} }
@ -420,7 +419,7 @@ private void surface_KeyDown(object sender, KeyEventArgs e)
private void ChangeCurrentShapeType(ShapeType shapeType) private void ChangeCurrentShapeType(ShapeType shapeType)
{ {
CurrentShapeType = shapeType; CurrentShapeType = shapeType;
//config.CurrentShapeType = shapeType; config.CurrentShapeType = CurrentShapeType;
DeselectArea(); DeselectArea();
} }
@ -654,10 +653,7 @@ public BaseShape CreateRegionShape(Rectangle rect)
shape = new RectangleRegionShape(); shape = new RectangleRegionShape();
break; break;
case ShapeType.RegionRoundedRectangle: case ShapeType.RegionRoundedRectangle:
shape = new RoundedRectangleRegionShape() shape = new RoundedRectangleRegionShape();
{
Radius = RoundedRectangleRadius
};
break; break;
case ShapeType.RegionEllipse: case ShapeType.RegionEllipse:
shape = new EllipseRegionShape(); shape = new EllipseRegionShape();
@ -666,20 +662,17 @@ public BaseShape CreateRegionShape(Rectangle rect)
shape = new RectangleDrawingShape(); shape = new RectangleDrawingShape();
break; break;
case ShapeType.DrawingRoundedRectangle: case ShapeType.DrawingRoundedRectangle:
shape = new RoundedRectangleDrawingShape() shape = new RoundedRectangleDrawingShape();
{
Radius = RoundedRectangleRadius
};
break; break;
case ShapeType.DrawingEllipse: case ShapeType.DrawingEllipse:
shape = new EllipseDrawingShape(); shape = new EllipseDrawingShape();
break; break;
case ShapeType.DrawingArrow:
shape = new ArrowDrawingShape();
break;
case ShapeType.DrawingLine: case ShapeType.DrawingLine:
shape = new LineDrawingShape(); shape = new LineDrawingShape();
break; break;
case ShapeType.DrawingArrow:
shape = new ArrowDrawingShape();
break;
} }
shape.Rectangle = rect; shape.Rectangle = rect;
@ -709,7 +702,7 @@ private void UpdateShape(BaseShape shape)
if (shape is IRoundedRectangleShape) if (shape is IRoundedRectangleShape)
{ {
IRoundedRectangleShape roundedRectangleShape = (IRoundedRectangleShape)shape; IRoundedRectangleShape roundedRectangleShape = (IRoundedRectangleShape)shape;
roundedRectangleShape.Radius = RoundedRectangleRadius; roundedRectangleShape.Radius = config.RoundedRectangleRadius;
} }
} }
} }

View file

@ -110,6 +110,9 @@ public class SurfaceOptions
[DefaultValue(typeof(Color), "0, 0, 0, 0")] [DefaultValue(typeof(Color), "0, 0, 0, 0")]
public Color ShapeFillColor { get; set; } = Color.FromArgb(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() public SurfaceOptions()
{ {
this.ApplyDefaultPropertyValues(); this.ApplyDefaultPropertyValues();