Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# Windows Forms screenshot

// 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: #Windows #Forms #screenshot
ADD COMMENT
Topic
Name
1+2 =