/// <summary> /// Color click /// </summary> private void pnlColor_Click(object sender, EventArgs e) { if (_selected != null) { _selected.Selected = false; } _selected = sender as ColorControl; _selected.Selected = true; SelectedColorChanged?.Invoke(); }
/// <summary> /// Sets the palette control's color palette /// </summary> /// <param name="palette"></param> public void SetPalette(List <Color> palette) { if (_selected != null) { _selected.Selected = false; _selected = null; } if (palette.Count < 32) { for (int i = palette.Count - 1; i < 32; i++) { palette.Add(Color.Black); } } for (int i = 0; i < 32; i++) { (Controls.Find("pnlColor" + i, true)[0] as Panel).BackColor = palette[i]; } }
/// <summary> /// Sets the palette control's color palette /// </summary> /// <param name="palette"></param> public void SetPalette(List <Color> import, Bitmap palette) { if (_selected != null) { _selected.Selected = false; _selected = null; } if (import.Count < 16) { for (int i = import.Count - 1; i < 16; i++) { import.Add(Color.Transparent); } } for (int i = 0; i < 16; i++) { (Controls.Find("pnlColor" + i, true)[0] as Panel).BackColor = import[i]; } pnlTargetPalette.Image = palette; }