请问哪位在.NET2.0中中使用过打印的几个控件,指导一下,怎样使用,第一次做打印,多多指教阿!  谢谢!

解决方案 »

  1.   

    这里有详细的实例
    http://blog.csdn.net/roguish/archive/2006/04/19/669475.aspx
      

  2.   

    参考如下的一个简单例子:
    private void button3_Click(object sender, EventArgs e)
    {
    PrintDocument doc = new PrintDocument();
    doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);
    PrintPreviewDialog pd = new PrintPreviewDialog();
    pd.Document = doc;
    pd.ShowDialog(this); this.panel2.BackgroundImage = null;
    }void doc_PrintPage(object sender, PrintPageEventArgs e)
    {
    using (Font font = new Font("宋体", 9))
    {
    using (StringFormat format = new StringFormat())
    {
    format.LineAlignment = StringAlignment.Center;
    format.Alignment = StringAlignment.Center;
    e.Graphics.DrawString("打印测试!", font, SystemBrushes.ControlText, e.PageBounds, format);
    }
    }
    }