void printButton_Click(object sender, EventArgs e) { CaptureScreen(); printDocument1.Print(); } //实现C# 打印窗体 Bitmap memoryImage; private void CaptureScreen() { Graphics myGraphics = this.CreateGraphics(); Size s = this.Size; memoryImage = new Bitmap(s.Width, s.Height, myGraphics); Graphics memoryGraphics = Graphics.FromImage(memoryImage); memoryGraphics.CopyFromScreen( this.Location.X, this.Location.Y, 0, 0, s); } private void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(memoryImage, 0, 0); }
报这样的错怎么解决
代码是网上下载无修改的,同样的文件在另一计算机上运行正常,不知何故。
自己编了些关于打印的代码,发现同样的问题,就是在另一台能编译正常执行,而在那台机上编译就会
解决方案:30分
楼主的电脑上装有打印机吗