Exemplo n.º 1
0
        /// <summary>
        /// Overridden to assign document to preview control only after the 
        /// initial activation.
        /// </summary>
        /// <param name="e"><see cref="EventArgs"/> that contains the event data.</param>
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            if (this.imgSignature == null)
            {
                CommFunc.MsgErr("Can not get signature.");
                this.Close();
            }
            else
            {
                if (string.IsNullOrEmpty(this.strSelPrinter))
                {
                    using (var dlg = new frmPrintSetting())
                    {
                        // show dialog
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            this.currItemIndex = 1;
                            this.strSelPrinter = dlg.SelPrinter;
                            this.mainTray = dlg.MainTray;
                            this.altTray = dlg.AltTray;
                            this.printdoc.DefaultPageSettings.PrinterSettings.PrinterName = this.strSelPrinter;
                        }
                    }
                }

                if (this.printdoc != null)
                    this._preview.PrintDoc = this.printdoc;
            }
        }
Exemplo n.º 2
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.strSelPrinter))
            {
                using (var dlg = new frmPrintSetting())
                {
                    // show dialog
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        this.strSelPrinter = dlg.SelPrinter;
                        this.mainTray = dlg.MainTray;
                        this.altTray = dlg.AltTray;
                        this.printdoc.DefaultPageSettings.PrinterSettings.PrinterName = this.strSelPrinter;
                    }
                }
            }

            this.currItemIndex = 1;
            // print selected page range
            this._preview.Print();
            string strRes = DalRules.DoPrintChequeNo(strBatchNo, GlobalParam.Inst.gsUserID);
            if (!string.IsNullOrEmpty(strRes))
            {
                CommFunc.MsgErr(strRes);
            }
            else
            {
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }