Esempio n. 1
0
        void chat_ParseColor(string value, Button target)
        {
            char code = value[1];

            target.Text = Colors.Name(value);

            Color textCol;

            target.BackColor = ColorSelector.LookupColor(code, out textCol);
            target.ForeColor = textCol;
        }
Esempio n. 2
0
        void chat_ShowColorDialog(Button target, string title)
        {
            string parsed = Colors.Parse(target.Text);
            char   col    = parsed.Length == 0 ? 'f' : parsed[1];

            using (ColorSelector sel = new ColorSelector(title, col)) {
                DialogResult result = sel.ShowDialog();
                if (result == DialogResult.Cancel)
                {
                    return;
                }

                target.Text = Colors.Name(sel.ColorCode);
                Color textCol;
                target.BackColor = ColorSelector.LookupColor(sel.ColorCode, out textCol);
                target.ForeColor = textCol;
            }
        }