• XtraReport 打印控件 预览打印按钮控制


    //Load
       
        private void FrmReport_DataSourceDemanded(object sender, EventArgs e)
        {
            try
            {
                #region 放到构造函数没效果
                //this.ShowPrintStatusDialog = false;
                this.ShowPrintMarginsWarning = false;
                #endregion
                InitData();
                _xtraReport = (XtraReport)sender;
                LoadData();
            }
            catch (Exception ex)
            {
                WriteExceptionLog(ex);
            }
        }

     

    调用

     

    打印操作权限-是否允许多次打印
        private void FrmReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            if (!IsPrint)//判读是否打印还是预览
            {
    
                if (!IsMultiplePrintBill)
                {
                    if (_CM_PrintNumber != null && _CM_PrintNumber.PrintNumber > 1)
                    {
    
                        XtraReport x = _xtraReport;
                        setcomm(x);
                    }
                }
                e.Cancel = false;
            }
            else
            {
                if (IsMultiplePrintBill)//是否允许多次打印
                {
                    //_xtraReport = (XtraReport)sender;
                    //LoadData();
                    e.Cancel = false;
                }
                else
                {
                    if (_CM_PrintNumber != null && _CM_PrintNumber.PrintNumber > 1)
                    {
                        XtraMessageBox.Show("您没有多次打印单据的权限!", "系统提示");
                        e.Cancel = true;
                    }
                }
            }
        }

     

     

    private void setcomm(XtraReport x)
        {
    
            DevExpress.XtraPrinting.PrintingSystemBase mPSB = x.PrintingSystem;
            mPSB.StartPrint += new PrintDocumentEventHandler(this.FrmPrint_StartPrint);
    
    
            //DevExpress.XtraPrinting.PrintingSystemCommand c = new PrintingSystemCommand();
            //mPSB.SetCommandVisibility(new DevExpress.XtraPrinting.PrintingSystemCommand[] 
            //{ 
            //        DevExpress.XtraPrinting.PrintingSystemCommand.Open ,
            //        DevExpress.XtraPrinting.PrintingSystemCommand.PageSetup ,
            //        DevExpress.XtraPrinting.PrintingSystemCommand.Print ,
            //        DevExpress.XtraPrinting.PrintingSystemCommand.PrintDirect ,
            //        DevExpress.XtraPrinting.PrintingSystemCommand.Save,
            //        DevExpress.XtraPrinting.PrintingSystemCommand.ExportCsv,
            //    }, DevExpress.XtraPrinting.CommandVisibility.None);
        }
    
        private void FrmPrint_StartPrint(object sender, PrintDocumentEventArgs e)
        {
            if (!IsMultiplePrintBill)
            {
                if (_CM_PrintNumber != null && _CM_PrintNumber.PrintNumber > 1)
                {
                    e.PrintDocument.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(this.FrmPrint_Print);
                    e.PrintDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.FrmPrint_Print);
                }
            
            }
        }
    
        private void FrmPrint_Print(object sender, PrintEventArgs e)
        {
            if (_CM_PrintNumber != null && _CM_PrintNumber.PrintNumber > 1)
            {
                XtraMessageBox.Show("您没有多次打印单据的权限!", "系统提示");
                e.Cancel = true;
                return;
            }
            e.Cancel = false;
        }
  • 相关阅读:
    Vue 获取URL链接后面的参数值
    Vue 跳转到指定页面,返回到上一页
    Vant 插件
    Vue 返回上一页,记住上一页的数据
    vue pc端支付宝支付
    Spring 中的事务
    数据库中锁与事务
    《产品方法论》 读书笔记
    设计模式之装饰者模式
    设计模式之单例模式
  • 原文地址:https://www.cnblogs.com/shangdishijiao/p/6762123.html
Copyright © 2020-2023  润新知