public SwatchContainer() { InitializeComponent(); // // swatchDisplayer1 // _swatchDisplayer = new SwatchDisplayer(); _swatchDisplayer.Dock = DockStyle.Fill; _swatchDisplayer.Location = new Point(0, 0); _swatchDisplayer.Name = "swatchDisplayer1"; _swatchDisplayer.Scale = 0; _swatchDisplayer.ScrollBar = null; _swatchDisplayer.Size = new Size(251, 138); _swatchDisplayer.Swatch = null; _swatchDisplayer.TabIndex = 1; _swatchDisplayer.Text = "swatchDisplayer1"; _swatchDisplayer.ScrollBar = vScrollBar1; textBox1.Location = comboBox1.Location; textBox1.Size = comboBox1.Size; panel1.Controls.Add(_swatchDisplayer); _swatchDisplayer.BringToFront(); foreach (string f in _swatchNames) { ToolStripItem item = convertSwatchStripButton.DropDownItems.Add(f); item.Click += item_Click; } }
public void PerformRemoveSwatch() { ISwatch swatch = SwatchDisplayer.Swatch; if (swatch == null) { return; } if (SwatchDisplayer.HasPrimaryColor) { swatch.RemoveAt(SwatchDisplayer.PrimaryColorIndex); if (swatch.Count == 0) { SwatchDisplayer.PrimaryColorIndex = SwatchDisplayer.SecondaryColorIndex = -1; } else { if (SwatchDisplayer.PrimaryColorIndex >= swatch.Count) { SwatchDisplayer.PrimaryColorIndex = swatch.Count - 1; } if (SwatchDisplayer.SecondaryColorIndex >= swatch.Count) { SwatchDisplayer.SecondaryColorIndex = swatch.Count - 1; } } SwatchDisplayer.RecalculateSize(); } }
public void PerformAddSwatch() { ISwatch swatch = SwatchDisplayer.Swatch; if (swatch == null) { return; } swatch.Add(new NamedColor("New Color", Editor.MainForm.ColorPanel.SelectedColor.RGB)); SwatchDisplayer.RecalculateSize(); }