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); 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(); ColorNames.Sort();
cbFillColor.Items.Clear(); cbFillColor.Items.Clear();
cbLineColor.Items.Clear(); cbLineColor.Items.Clear();
@ -1495,12 +1495,19 @@ namespace EduNetworkBuilder
//We just made a shape. //We just made a shape.
try try
{ {
Color FillColor = Color.FromName(cbFillColor.Text); string fColor = cbFillColor.Text;
Color LineColor = Color.FromName(cbLineColor.Text); string lColor = cbLineColor.Text;
NetShape NS = new NetShape(CurrentShape, selectbox,FillColor,LineColor); 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); myNetwork.AddShape(NS);
UpdateForm(); UpdateForm();
}
} }
catch catch
{ {