private void UpdateGroupBoxWithColorSet(string name, ColorSet cs) { if (cs == null) { panelColorSet.Enabled = false; label2.ForeColor = ThemeColorTable.ForeColorDisabled; label3.ForeColor = ThemeColorTable.ForeColorDisabled; textBoxName.Text = string.Empty; tableLayoutPanelColors.Controls.Clear(); return; } panelColorSet.Enabled = true; label2.ForeColor = ThemeColorTable.ForeColor; label3.ForeColor = ThemeColorTable.ForeColor; textBoxName.Text = name; tableLayoutPanelColors.Controls.Clear(); foreach (System.Drawing.Color color in cs) { ColorPanel colorPanel = new ColorPanel(color); tableLayoutPanelColors.Controls.Add(colorPanel); } }
private bool displayedColorSetHasDifferences() { if (!panelColorSet.Enabled) return false; if (_data.ContainsColorSet(textBoxName.Text)) { ColorSet cs = _data.GetColorSet(textBoxName.Text); int i = 0; foreach (var control in tableLayoutPanelColors.Controls) { if (cs.Count <= i) return true; ColorPanel cp = (ColorPanel)control; if (cs[i].ToArgb() != cp.Color.ToArgb()) return true; i++; } if (cs.Count != i) return true; return false; } return true; }
private bool SaveDisplayedColorSet() { string name = textBoxName.Text; ColorSet newColorSet = new ColorSet(); if (name.Length <= 0) { MessageBox.Show("You must enter a name for the Color Set.", "Name Requred", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } foreach (var control in tableLayoutPanelColors.Controls) { ColorPanel cp = (ColorPanel)control; newColorSet.Add(cp.Color); } _data.SetColorSet(textBoxName.Text, newColorSet); return(true); }
private bool SaveDisplayedColorSet() { string name = textBoxName.Text; ColorSet newColorSet = new ColorSet(); if (name.Length <= 0) { //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible) MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form. var messageBox = new MessageBoxForm("You must enter a name for the Color Set.", "Name Requred", false, false); messageBox.ShowDialog(); return false; } foreach (var control in tableLayoutPanelColors.Controls) { ColorPanel cp = (ColorPanel)control; newColorSet.Add(cp.Color); } _data.SetColorSet(textBoxName.Text, newColorSet); return true; }
private void buttonAddColor_Click(object sender, EventArgs e) { ColorPanel colorPanel = new ColorPanel(System.Drawing.Color.White); tableLayoutPanelColors.Controls.Add(colorPanel); }
private void buttonAddColor_Click(object sender, EventArgs e) { ColorPanel colorPanel = new ColorPanel(System.Drawing.Color.FromArgb(255, 255, 255)); tableLayoutPanelColors.Controls.Add(colorPanel); }