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\repos\{project}\{project}\bin\Debug )
bitmap.Save("test.jpg", ImageFormat.Jpeg);
}
Also in C#:
- ASP select box all states
- c# split large file into chunks
- c# declare an int list
- c# get today's date
- unity rigidbody addforce
- c# textbox tab column
- regex replace all special characters
- c# serialize
- how to convert object in string JSON c#
- c# webrequest cookies
- get all child gameObject of gameObject C#
- Linq - Random Elements
- 2d object look at object
- get type of variable c#
- length of a string c#
- how to move clipping planes C# in unity
- c# save pdf to folder
- c# param exception
- asp.net textarea disable resize
- tachyons
- binding c#
- c# while loop
- c# return two variables of different types
- how to get the last element in an array in c#