Capture Current Soft Screen

时间:2023-03-09 22:31:08
Capture Current Soft Screen

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(object sender, PrintPageEventArgs e)
{

e.Graphics.DrawImage(memoryImage, 0, 0);
}