Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

take screenshot in c#

using System.Windows.Forms; 
using Point = System.Drawing.Point;
using Rectangle = System.Drawing.Rectangle;
Rectangle bounds = Screen.GetBounds(Point.Empty);

using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
    using(Graphics g = Graphics.FromImage(bitmap))
    {
         g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
    }
    // will save to working directory  ( for C# WPF in VS 2019: C:Users{user}source
epos{project}{project}inDebug )
    bitmap.Save("test.jpg", ImageFormat.Jpeg);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #screenshot
ADD COMMENT
Topic
Name
4+4 =