private void ColourClicked(object sender, EventArgs e)
        {
            var visgroup = VisgroupPanel.SelectedVisgroup;

            if (visgroup == null)
            {
                return;
            }

            var vg = (Vg)visgroup.Tag;

            using (var cp = new ColorDialog {
                Color = vg.Colour
            })
            {
                if (cp.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ColourPanel.BackColor = visgroup.Colour = vg.Colour = cp.Color;
                ColourPanel.ForeColor = vg.Colour.GetIdealForegroundColour();
                VisgroupPanel.UpdateVisgroupState(visgroup);
            }
        }
        private void GroupNameChanged(object sender, EventArgs e)
        {
            var visgroup = VisgroupPanel.SelectedVisgroup;

            if (visgroup == null)
            {
                return;
            }

            var vg = (Vg)visgroup.Tag;

            if (vg.Name == GroupName.Text)
            {
                return;
            }
            visgroup.Text = vg.Name = GroupName.Text;
            VisgroupPanel.UpdateVisgroupState(visgroup);
        }