{
	"id": "0ca8af83-8719-4d2b-aed1-b22b40d77c12",
	"created_at": "2026-04-06T00:13:41.555437Z",
	"updated_at": "2026-04-10T03:20:36.819607Z",
	"deleted_at": null,
	"sha1_hash": "aeeae49e23ab6f4462a68ecb3dccd2785e2e404e",
	"title": "Graphics.CopyFromScreen Method (System.Drawing)",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 54164,
	"plain_text": "Graphics.CopyFromScreen Method (System.Drawing)\r\nBy dotnet-bot\r\nArchived: 2026-04-05 19:17:42 UTC\r\nCopyFromScreen(Int32, Int32, Int32, Int32, Size)\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nSource:\r\nGraphics.cs\r\nPerforms a bit-block transfer of the color data, corresponding to a rectangle of pixels, from the screen to the\r\ndrawing surface of the Graphics.\r\npublic void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, System.Drawing.Size bl\r\nParameters\r\nsourceX\r\nInt32\r\nThe x-coordinate of the point at the upper-left corner of the source rectangle.\r\nsourceY\r\nhttps://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen?view=netframework-4.8\r\nPage 1 of 3\n\nInt32\r\nThe y-coordinate of the point at the upper-left corner of the source rectangle.\r\ndestinationX\r\nInt32\r\nThe x-coordinate of the point at the upper-left corner of the destination rectangle.\r\ndestinationY\r\nInt32\r\nThe y-coordinate of the point at the upper-left corner of the destination rectangle.\r\nblockRegionSize\r\nSize\r\nThe size of the area to be transferred.\r\nExceptions\r\nExamples\r\nThe following code example demonstrates how to use the CopyFromScreen for printing a copy of the current\r\nform.\r\nusing System;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Drawing.Printing;\r\npublic class Form1 :\r\n Form\r\n{\r\n private Button printButton = new Button();\r\n private PrintDocument printDocument1 = new PrintDocument();\r\n public Form1()\r\n {\r\n printButton.Text = \"Print Form\";\r\n printButton.Click += new EventHandler(printButton_Click);\r\n printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);\r\n this.Controls.Add(printButton);\r\n }\r\n void printButton_Click(object sender, EventArgs e)\r\n {\r\nhttps://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen?view=netframework-4.8\r\nPage 2 of 3\n\nCaptureScreen();\r\n printDocument1.Print();\r\n }\r\n Bitmap memoryImage;\r\n private void CaptureScreen()\r\n {\r\n Graphics myGraphics = this.CreateGraphics();\r\n Size s = this.Size;\r\n memoryImage = new Bitmap(s.Width, s.Height, myGraphics);\r\n Graphics memoryGraphics = Graphics.FromImage(memoryImage);\r\n memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);\r\n }\r\n private void printDocument1_PrintPage(System.Object sender,\r\n System.Drawing.Printing.PrintPageEventArgs e)\r\n {\r\n e.Graphics.DrawImage(memoryImage, 0, 0);\r\n }\r\n public static void Main()\r\n {\r\n Application.Run(new Form1());\r\n }\r\n}\r\nRemarks\r\nThe CopyFromScreen methods are useful for layering one image on top of another. To specify how the source and\r\ndestination colors are blended, use one of the CopyFromScreen methods that takes a CopyPixelOperation\r\nparameter.\r\nSee also\r\nHow to: Print a Windows Form\r\nHow to: Copy Pixels For Reducing Flicker in Windows Forms\r\nApplies to\r\n.NET 11 (package-provided) and other versions\r\nSource: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen?view=netframework-4.8\r\nhttps://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen?view=netframework-4.8\r\nPage 3 of 3",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen?view=netframework-4.8"
	],
	"report_names": [
		"system.drawing.graphics.copyfromscreen?view=netframework-4.8"
	],
	"threat_actors": [],
	"ts_created_at": 1775434421,
	"ts_updated_at": 1775791236,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/aeeae49e23ab6f4462a68ecb3dccd2785e2e404e.pdf",
		"text": "https://archive.orkl.eu/aeeae49e23ab6f4462a68ecb3dccd2785e2e404e.txt",
		"img": "https://archive.orkl.eu/aeeae49e23ab6f4462a68ecb3dccd2785e2e404e.jpg"
	}
}