From 05519891db2b366f9521aac45a74a11ca717870a Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 1 Mar 2018 08:18:20 -0600 Subject: [PATCH] Fill shape from form --- EduNetworkBuilder/ShapeEditor.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/EduNetworkBuilder/ShapeEditor.cs b/EduNetworkBuilder/ShapeEditor.cs index 3cad433..d885f01 100644 --- a/EduNetworkBuilder/ShapeEditor.cs +++ b/EduNetworkBuilder/ShapeEditor.cs @@ -70,6 +70,10 @@ namespace EduNetworkBuilder FieldsFromShape(ShapeForEditing); } + private void FieldsFromShape() + { + FieldsFromShape(ShapeForEditing); + } private void FieldsFromShape(NetShape theShape) { ShapeForEditing = theShape; @@ -97,6 +101,32 @@ namespace EduNetworkBuilder } } + private void ValuesToShape() + { + ValuesToShape(ShapeForEditing); + } + private void ValuesToShape(NetShape theShape) + { + ShapeForEditing = theShape; + if (ShapeForEditing != null) + { + int X, Y, Width, Height; + X = ShapeForEditing.InArea.X; + Y = ShapeForEditing.InArea.Y; + Width = ShapeForEditing.InArea.Width; + Height = ShapeForEditing.InArea.Height; + int.TryParse(tbX.Text, out X); + int.TryParse(tbY.Text, out Y); + int.TryParse(tbWidth.Text, out Width); + int.TryParse(tbHeight.Text, out Height); + ShapeForEditing.InArea = new Rectangle(X, Y, Width, Height); + ShapeForEditing.FillColor = Color.FromName(cbFillColor.Text); + ShapeForEditing.LineColor = Color.FromName(cbLineColor.Text); + ShapeForEditing.MyShape = NB.TryParseEnum(cbShape.Text, NetShapeType.rectangle); + } + + } + private void btnDone_Click(object sender, EventArgs e) { Close();