protected override void OnDropDown(EventArgs e) { if (Items.Count <= 1) { Color selectedColor = this.ColorChoice; this.BeginUpdate(); Items.Clear(); if (!ColorDictionary.IsColorOfType(selectedColor, _colorType)) { Items.Add(selectedColor); } foreach (Color c in ColorDictionary.GetColorsOfType(_colorType)) { Items.Add(c); } SelectedItem = ColorDictionary.GetNormalizedColor(selectedColor, _colorType); this.EndUpdate(); } base.OnDropDown(e); }
protected override void OnDropDown(EventArgs e) { if (Items.Count <= 1) { BrushX selectedBrush = this.Brush; this.BeginUpdate(); Items.Clear(); if (selectedBrush.BrushType == BrushType.SolidBrush) { if (!ColorDictionary.IsColorOfType(selectedBrush.Color, _colorType)) { Items.Add(selectedBrush.Color); } } else { Items.Add(selectedBrush); } foreach (Color c in ColorDictionary.GetColorsOfType(_colorType)) { Items.Add(c); } if (selectedBrush.BrushType == BrushType.SolidBrush) { SelectedItem = ColorDictionary.GetNormalizedColor(selectedBrush.Color, _colorType); } else { SelectedItem = selectedBrush; } this.EndUpdate(); } base.OnDropDown(e); }