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 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;
}
}
}

View file

@ -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();