Example #1
0
        void click_context_relabel(object sender, EventArgs e)
        {
            Swatch swatch = _tiles[_sel];

            using (var f = new SwatchDialog(swatch))
            {
                if (f.ShowDialog(this) == DialogResult.OK &&
                    f.Description != swatch.Description)
                {
                    swatch.Description = f.Description;
                    _tiles[_sel]       = swatch;               // effin structs

                    SwatchIo.Write(_tiles);
                }
            }
        }
Example #2
0
        void click_context_append(object sender, EventArgs e)
        {
            ClearSelector();

            Color color = ColorF.That.ColorControl.GetActiveColorbox().BackColor;

            int id = ColorExists(color);

            if (id == _firstBlankId)
            {
                using (var f = new SwatchDialog(color))
                {
                    if (f.ShowDialog(this) == DialogResult.OK)
                    {
                        ++_firstBlankId;

                        Swatch swatch = _tiles[id];

                        using (Graphics graphics = Graphics.FromImage(_graphic))
                        {
                            using (var brush = new SolidBrush(color))
                                graphics.FillRectangle(brush, swatch.Rect);

                            graphics.DrawRectangle(Pens.Black, swatch.Rect);
                        }

                        swatch.Color       = color;
                        swatch.Description = f.Description;
                        _tiles[id]         = swatch;

                        InvalidateSwatch(_tiles[_sel = id]);

                        SwatchIo.Write(_tiles);
                    }
                }
            }
            else
            {
                InvalidateSwatch(_tiles[_sel = id]);
            }
        }