Esempio n. 1
0
        public void DisplayColorList()
        {
            pnlColors.Controls.Clear();
            for (int idx = 0; idx < Colors.Count; idx++)
            {
                string labelText;
                switch (idx)
                {
                case 0:
                    labelText = "Background";
                    break;

                case 1:
                    labelText = "Grid";
                    break;

                default:
                    labelText = "Layer " + (idx - 1);
                    break;
                }
                var btnColorButton = new ColorButton(labelText, Colors[idx], idx);
                btnColorButton.Width  = 100;
                btnColorButton.Click += new System.EventHandler(colorBtnClick);
                pnlColors.Controls.Add(btnColorButton);
            }
        }
Esempio n. 2
0
        private void colorBtnClick(object sender, EventArgs args)
        {
            ColorButton btn = (sender as ColorButton);

            ColorPicker.Color = btn.LayerColor;
            EditingColorIdx   = btn.ColorIdx;
            if (ColorPicker.ShowDialog() != DialogResult.Cancel)
            {
                Colors[btn.ColorIdx] = ColorPicker.Color;
                btn.SetColor(ColorPicker.Color);
                pictureBox.Invalidate();
                SaveColors();
            }
        }