From d6a2a62c9ba09d93af753e25e0fae88590110505 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Mon, 26 Feb 2018 18:07:56 -0600 Subject: [PATCH] Add color choosing boxes for Line and Fill colors for use when adding a shape. --- EduNetworkBuilder/NetworkBuilder.Designer.cs | 22 +++++++++++++++ EduNetworkBuilder/NetworkBuilder.cs | 29 ++++++++++++++++++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/EduNetworkBuilder/NetworkBuilder.Designer.cs b/EduNetworkBuilder/NetworkBuilder.Designer.cs index bc8e582..f4952b6 100644 --- a/EduNetworkBuilder/NetworkBuilder.Designer.cs +++ b/EduNetworkBuilder/NetworkBuilder.Designer.cs @@ -76,6 +76,8 @@ this.HelpPanel = new System.Windows.Forms.Panel(); this.btnCaptions = new System.Windows.Forms.Button(); this.myProgressBar = new System.Windows.Forms.ProgressBar(); + this.cbLineColor = new System.Windows.Forms.ComboBox(); + this.cbFillColor = new System.Windows.Forms.ComboBox(); this.msMainMenuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit(); this.HelpPanel.SuspendLayout(); @@ -515,11 +517,29 @@ this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.myProgressBar.TabIndex = 11; // + // cbLineColor + // + this.cbLineColor.FormattingEnabled = true; + this.cbLineColor.Location = new System.Drawing.Point(12, 433); + this.cbLineColor.Name = "cbLineColor"; + this.cbLineColor.Size = new System.Drawing.Size(79, 24); + this.cbLineColor.TabIndex = 12; + // + // cbFillColor + // + this.cbFillColor.FormattingEnabled = true; + this.cbFillColor.Location = new System.Drawing.Point(11, 463); + this.cbFillColor.Name = "cbFillColor"; + this.cbFillColor.Size = new System.Drawing.Size(80, 24); + this.cbFillColor.TabIndex = 13; + // // BuilderWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(617, 507); + this.Controls.Add(this.cbFillColor); + this.Controls.Add(this.cbLineColor); this.Controls.Add(this.myProgressBar); this.Controls.Add(this.lblStatus); this.Controls.Add(this.lbMessages); @@ -598,6 +618,8 @@ private System.Windows.Forms.ToolStripMenuItem logoutToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem randomToolStripMenuItem; private System.Windows.Forms.Button btnCaptions; + private System.Windows.Forms.ComboBox cbLineColor; + private System.Windows.Forms.ComboBox cbFillColor; } } diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 7269300..7289a1d 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -95,6 +95,16 @@ namespace EduNetworkBuilder myNetwork.RegisterDisplayArea(pbNetworkView); + List ColorNames = new List() { "Black","White","Green","LightGreen","Blue","LightBlue","Grey","Brown","SaddleBrown" }; + ColorNames.Sort(); + cbFillColor.Items.Clear(); + cbLineColor.Items.Clear(); + foreach(string ColorName in ColorNames) + { + cbFillColor.Items.Add(ColorName); + cbLineColor.Items.Add(ColorName); + } + BuildButtons(); LayoutButtons(); UpdateForm(); @@ -548,6 +558,16 @@ namespace EduNetworkBuilder UpdateMenu(); UpdateMessages(); UpdateVisuals(); + if(selectedButton == "btnShapes") + { + cbFillColor.Visible = true; + cbLineColor.Visible = true; + } + else + { + cbFillColor.Visible = false; + cbLineColor.Visible = false; + } if (myNetwork != null && myNetwork.LoadedFromResource) optionsToolStripMenuItem.Visible = false; else @@ -711,6 +731,8 @@ namespace EduNetworkBuilder private void btnClick(object sender, EventArgs e) { + bool doupdate = false; + if (selectedButton == "btnShapes") doupdate = true; foreach(Control btn in Buttons) { if(btn == sender) @@ -719,12 +741,14 @@ namespace EduNetworkBuilder btn.BackColor = Color.LightGreen; selectedButton = btn.Name; lblStatus.Text = myTooltip.GetToolTip(btn); + if (selectedButton == "btnShapes") doupdate = true; } else { btn.BackColor = Button.DefaultBackColor; } } + if (doupdate) UpdateForm(); } private void btnReset() { @@ -2527,9 +2551,8 @@ namespace EduNetworkBuilder UpdateForm(); UpdateMessages(); } - #endregion Random Map Stuff - - + + #endregion Random Map Stuff } } \ No newline at end of file