Allow empty colors, but if both are empty, do not use them.

This commit is contained in:
Tim Young 2018-02-27 16:21:57 -06:00
parent 1d1290c3c2
commit a06f27a836

View File

@ -99,7 +99,7 @@ namespace EduNetworkBuilder
myNetwork.RegisterDisplayArea(pbNetworkView);
List<string> ColorNames = new List<string>() { "Black","White","Green","LightGreen","Blue","LightBlue","Grey","Brown","SaddleBrown" };
List<string> ColorNames = new List<string>() { "Black","White","Green","LightGreen","Blue","LightBlue","Grey","Brown","SaddleBrown", "Empty" };
ColorNames.Sort();
cbFillColor.Items.Clear();
cbLineColor.Items.Clear();
@ -1495,12 +1495,19 @@ namespace EduNetworkBuilder
//We just made a shape.
try
{
Color FillColor = Color.FromName(cbFillColor.Text);
Color LineColor = Color.FromName(cbLineColor.Text);
NetShape NS = new NetShape(CurrentShape, selectbox,FillColor,LineColor);
string fColor = cbFillColor.Text;
string lColor = cbLineColor.Text;
if (fColor == "") fColor = "Empty";
if (lColor == "") lColor = "Empty";
Color FillColor = Color.FromName(fColor);
Color LineColor = Color.FromName(lColor);
if (LineColor.Name != "Empty" || FillColor.Name != "Empty")
{
NetShape NS = new NetShape(CurrentShape, selectbox, FillColor, LineColor);
myNetwork.AddShape(NS);
UpdateForm();
myNetwork.AddShape(NS);
UpdateForm();
}
}
catch
{