在一个显示详细信息的窗体,每个label标签后面跟一个TextBox,在最后有几个按钮,如何完成打印及打印预览功能(最后面的几个button不用打印了),要一个比较详细的代码。
这里用的的打印控件就用工具箱中的那几个就行了。

解决方案 »

  1.   

    printdocument
    private void PrinttoolStripMenuItem_Click(object sender, EventArgs e)
            {
                //实现打印
                int width =this.Width+60;
                int height = this.Height;            print = new Bitmap(width, height);
                Graphics g = Graphics.FromImage(print);
                Size tmpSize;
                tmpSize = this.Size;
                tmpSize.Height = tmpSize.Height-60;
                tmpSize.Width = tmpSize.Width;
                g.CopyFromScreen(this.Location.X+6, this.Location.Y + 55, 80, 30, tmpSize);            this.printPreviewDialog.Document = this.printDocument;
                this.printPreviewDialog.ShowDialog(this);
            }        private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
            {
                e.Graphics.DrawImage(print, 0, 0);
            }
      

  2.   

    printdocument 
    private void PrinttoolStripMenuItem_Click(object sender, EventArgs e) 
            { 
                //实现打印 
                int width =this.Width+60; 
                int height = this.Height;             print = new Bitmap(width, height); 
                Graphics g = Graphics.FromImage(print); 
                Size tmpSize; 
                tmpSize = this.Size; 
                tmpSize.Height = tmpSize.Height-60; 
                tmpSize.Width = tmpSize.Width; 
                g.CopyFromScreen(this.Location.X+6, this.Location.Y + 55, 80, 30, tmpSize);             this.printPreviewDialog.Document = this.printDocument; 
                this.printPreviewDialog.ShowDialog(this); 
            }         private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) 
            { 
                e.Graphics.DrawImage(print, 0, 0); 
            } 
      

  3.   

    在弱弱的问句
    PrinttoolStripMenuItem_Click是哪个控件的单击事件?