Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

screenshot c# WinForms

// doing a screenshot from control "panel2"
string filename = "временный файл.jpeg";
Bitmap printscreen = new Bitmap(panel2.Width - 5, panel2.Height - 5);
Graphics graphics = Graphics.FromImage(printscreen as System.Drawing.Image);
int top = this.Top + panel2.Top + 35;
int left = this.Left + panel2.Left + 10;
graphics.CopyFromScreen(left, top, 0, 0, printscreen.Size);
printscreen.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);
 
PREVIOUS NEXT
Tagged: #screenshot #WinForms
ADD COMMENT
Topic
Name
4+3 =