用水晶报表画好你要打印的内容,将报表扔到CrystalReportViewer中(设置其ReportSource属性),最后调用CrystalReportViewer.PrintReport()方法,就输出到打印机了。VS2005/2008 带有水晶报表的简版。

解决方案 »

  1.   

    得用GUI+  不过你这样的貌似不难 参考MSDN
      

  2.   

    使用PrintDocument
    然后向里面画内容
      

  3.   

    可以考虑其他控件,如Aspose做这方面的东西很好
      

  4.   

    参考C# WinForm开发系列 - Print
      

  5.   

    用CrystalReportViewer和PrintDocument 
     我知道 但是不知道怎么处理动态的东西,
    比如消费的项目的数量并不是固定的,
    可能只有一个,也可能有几个,也可能有几十个。
    GUI+好像是画图之类的吧 
     fastreport 和 Aspose 更不会用,头一次听说 呵呵参考C# WinForm开发系列 - Print  我还在看希望能给个具体的例子 关键是动态的地方我现在的代码是: String text0 = ""; String text1 = "";
                //获取文本框的内容绘制图形传到打印机打印
                text0 = this.textBox1.Text;
                text1 = this.label1.Text;
                e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0);
                e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0, 50);
                e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue, 0, 100);
      

  6.   

    最近比较忙,没有及时结贴,
    先结贴
    解决方法就像我的代码:
    String text0 = ""; String text1 = ""; 
                //获取文本框的内容绘制图形传到打印机打印 
                text0 = this.textBox1.Text; 
                text1 = this.label1.Text; 
                e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0); 
                e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 20, 0); 
                e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue, 40, 0);我把横坐标设置成变量 然后判断要打印的内容是否存在就可以解决了如我申明 string a=20;
    我的代码就是
    String text0 = ""; String text1 = ""; 
                //获取文本框的内容绘制图形传到打印机打印 
                text0 = this.textBox1.Text; 
                text1 = this.label1.Text; 
                e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0); 
    if (texti存在值)
    {
                e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, a, 0); 
    a=a+20;
    }
                e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue,a , 0);结贴
      

  7.   

    错了 应该是 Int a=20;