页面上有个button点击后打印水晶报表,请大家说明如何执行打印的>?

解决方案 »

  1.   

    拖控件
            private void printPToolStripButton_Click(object sender, EventArgs e)
            {
                printDialog1.ShowDialog();
                printPreviewDialog1.Document = this.printDocument1;
                printPreviewDialog1.ShowDialog();
            }
      

  2.   

    哇,叶子(maco_wang)--唐宁,师妃暄?
    能不能不用js方法啊?
    rex
         你的方法是不是要拖两个控件进来呢?>
      

  3.   

    一个打印控件  一个预览控件
    其实还应该用一个  PrintDocument
    这样可以随便DrawLine DrawString
      

  4.   

    遇揽的做法
    System.Windows.Forms.Cursor svCursor = this.Cursor; 
    try
    {
     //鼠标等待
     this.Cursor = System.Windows.Forms.Cursors.WaitCursor;

      //打印遇染开着的时候在按就关掉
      if (this.PCtrl_PrinterPreview.Visible == true )
    {
    this.PCtrl_PrinterPreview.Visible = false;
    return;
    }
    //传到水晶报表里的变量,可有可无
    object[][] loRptObj = new object[][]
     {
    new object[] { "TitleYear",this.bpnParts_Date1.Number.ToString().Substring(0,4)},
    new object[] { "TitleMonth",this.bpnParts_Date1.Number.ToString().Substring(4,2)},
     };
    //dataset是否有数据
    if (kyostdataset.KYOSI.Rows.Count > 0)
    {
    this.PCtrl_PrinterPreview.startParts_Preview("BPN_KUT_STAT101RPT_01",this.kyostdataset,loRptObj);//水晶报表的名字,DATASET,和变量(没有就NULL)
    this.PCtrl_PrinterPreview.Visible = true;
    }
    else
    {
    messagebox.show("没数据");
    }
    // 処理结束
    if( this.PCtrl_PrinterPreview.Visible  )
    {
    this.PCtrl_PrinterPreview.Focus();
    }
    }
    catch(Exception ex)
    {
    throw ex;
    }
    finally 
    {
    this.Cursor = svCursor;
    }
      

  5.   


    winform你怎么用JS,先看好人家题目嘛
      

  6.   

    可以直接在RPT页面赋值,然后用下面方法直接打印 Crt1 cd = new Crt1(); 
    cd.PrintToPrinter(1,false,0,0);
      

  7.   

     感谢大家继续关注
                //打印机使用
                  PrintDialog pd = new PrintDialog();
                pd.Document = printDocument1;
                DialogResult result = pd.ShowDialog();            if (result == DialogResult.OK)
                {
                    printDocument1.Print();
                }黑人哥们你的那两句方法应该放在上面这段代码的什么地方呢?
                CrystalReportCheap crc = new CrystalReportCheap();
                crc.PrintToPrinter(1,false,0,0);
    ying0700
    暂时不用预览!只要能打出报表上的东西就OK