Fill shape from form

This commit is contained in:
Tim Young 2018-03-01 08:18:20 -06:00
parent 1a83ff7ce1
commit 05519891db
1 changed files with 30 additions and 0 deletions

View File

@ -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<NetShapeType>(cbShape.Text, NetShapeType.rectangle);
}
}
private void btnDone_Click(object sender, EventArgs e)
{
Close();