[System.Runtime.Interopservices.dllimport ("gdi32.dll")]]
Public Static Extern long bitblt (int NXDEST, INT NYDEST, INT NWIDTH, INT NHEIGHT, INTPTR HDCSRC, INT NXSRC, INT NYSRC, INT DWROP)
Private 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);
INTPTR DC1 = MyGraphics.getHDC ();
INTPTR DC2 = MemoryGraphics.getHDC ();
Bitblt (DC2, 0, 0, this.clientRectangle.width, this.clientRectangle.height, DC1, 0, 0, 13369376);
MyGraphics.ReleaseHDC (DC1);
MemoryGraphics.ReleaseHDC (DC2);
}
Private void printDocument1_printpage (System.Object sender, system.drawing.printing.printpageeventargs e)
{
E.Graphics.drawImage (MemoryImage, 0, 0);
}
Private Void PrintButton_Click (System.Object Sender, System.EventArgs E)
{
CaptureScreen ();
PRINTPREVIEWDIALOG1.SHOW ();
}