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);
            }
        }
        // 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);
            }
        }
Beispiel #3
0
        // 设置标签内容文件
        // 注:StreamReader 由 PrintLabelDocument 负责释放
        public int SetLabelFile(StreamReader sr,
                                out string strError)
        {
            strError = "";

            if (this._document == null)
            {
                this._document = new PrintLabelDocument();
            }

            int nRet = this._document.Open(sr,
                                           out strError);

            if (nRet == -1)
            {
                return(-1);
            }

            SetAutoScroll(this._label_param);
            return(0);
        }
Beispiel #4
0
        // 设置标签内容文件
        // 注:StreamReader 由 PrintLabelDocument 负责释放
        public int SetLabelFile(StreamReader sr,
            out string strError)
        {
            strError = "";

            if (this._document == null)
                this._document = new PrintLabelDocument();

            int nRet = this._document.Open(sr,
                out strError);
            if (nRet == -1)
                return -1;

            SetAutoScroll(this._label_param);
            return 0;
        }
Beispiel #5
0
        // 设置标签内容文件
        public int SetLabelFile(string strLabelFilename,
            out string strError)
        {
            strError = "";

            if (this.document == null)
                this.document = new PrintLabelDocument();

            int nRet = this.document.Open(strLabelFilename,
                out strError);
            if (nRet == -1)
                return -1;

            SetAutoScroll(this.label_param);

            return 0;
        }
Beispiel #6
0
 void EndPrint()
 {
     if (this.document != null)
     {
         this.document.Close();
         this.document = null;
     }
 }
Beispiel #7
0
        // parameters:
        //      strLabelFilename    标签文件名
        //      strDefFilename  定义文件名
        int BeginPrint(
            string strLabelFilename,
            string strDefFilename,
            out string strError)
        {
            strError = "";

            if (String.IsNullOrEmpty(strDefFilename) == true)
            {
                strError = "尚未指定标签定义文件名";
                return -1;
            }


            if (String.IsNullOrEmpty(strLabelFilename) == true)
            {
                strError = "尚未指定标签文件名";
                return -1;
            }

            LabelParam label_param = null;

            int nRet = LabelParam.Build(strDefFilename,
                out label_param,
                out strError);
            if (nRet == -1)
                return -1;

            this.label_param = label_param;

            if (this.document != null)
            {
                this.document.Close();
                this.document = null;
            }

            this.document = new PrintLabelDocument();
            nRet = this.document.Open(strLabelFilename,
                out strError);
            if (nRet == -1)
                return -1;

            this.document.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(document_PrintPage);
            this.document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(document_PrintPage);

            if (this.checkBox_testingGrid.Checked == true)
                this.m_strPrintStyle = "TestingGrid";
            else
                this.m_strPrintStyle = "";

            return 0;
        }