Пример #1
0
        // TODO: 能方便设置白色和透明色
        private void button_setBackColor_Click(object sender, EventArgs e)
        {
            Color trans_color = Color.Transparent;  //  Color.FromArgb(192, 192, 193);  // 使用一个罕见颜色
            Color old_color   = trans_color;

            if (string.IsNullOrEmpty(this.textBox_backColor.Text) == false)
            {
                old_color = PrintLabelDocument.GetColor(this.textBox_backColor.Text);
            }

            ColorDialog dlg = new ColorDialog();

            dlg.Color = old_color;
            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (dlg.Color == trans_color)
            {
                this.textBox_backColor.Text = "";
            }
            else
            {
                this.textBox_backColor.Text = PrintLabelDocument.GetColorString(dlg.Color);
            }
        }
Пример #2
0
        private void button_setForeColor_Click(object sender, EventArgs e)
        {
            Color old_color = Color.Black;

            if (string.IsNullOrEmpty(this.textBox_foreColor.Text) == false)
            {
                old_color = PrintLabelDocument.GetColor(this.textBox_foreColor.Text);
            }

            ColorDialog dlg = new ColorDialog();

            dlg.Color = old_color;
            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (dlg.Color == Color.Black)
            {
                this.textBox_foreColor.Text = "";
            }
            else
            {
                this.textBox_foreColor.Text = PrintLabelDocument.GetColorString(dlg.Color);
            }
        }