void OnNewColor(NewColorArgs e) { currentColor = e.NewColor; if (NewColor != null) { NewColor(this, e); } }
void InitializeColorTextBoxString(Color color, string sender) { bool useTransparent = false; Color knownColor = Color.Empty; bool bKnownColor = true; if (sender == "CustomTab" || sender == null) { bKnownColor = ColorUtil.IsKnownColor(color, ref knownColor, useTransparent); } else { knownColor = color; } if (bKnownColor) { color = knownColor; // update color in dropdown part colorTextBox.Text = color.Name; } else { // Format rgb string string sep = ","; string rgb = color.R.ToString() + sep + color.G.ToString() + sep + color.B.ToString(); colorTextBox.Text = rgb; } colorDropDown.CurrentColor = color; colorTextBox.SelectionLength = 0; colorTextBox.SelectionStart = colorTextBox.Text.Length + 1; // Fire event to whoever is listening if (sender != null) { NewColorArgs nca = new NewColorArgs(color); OnNewColor(nca); } }