From a06f27a836cfced23e7de62b8796bb8bffa07cc3 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Tue, 27 Feb 2018 16:21:57 -0600 Subject: [PATCH] Allow empty colors, but if both are empty, do not use them. --- EduNetworkBuilder/NetworkBuilder.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index fe5a4fb..4cad540 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -99,7 +99,7 @@ namespace EduNetworkBuilder myNetwork.RegisterDisplayArea(pbNetworkView); - List ColorNames = new List() { "Black","White","Green","LightGreen","Blue","LightBlue","Grey","Brown","SaddleBrown" }; + List ColorNames = new List() { "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 {