C#
C# Desktop(Screen) Capture - 스크린 캡쳐
J-sean
2021. 12. 23. 00:45
반응형
간단히 화면을 캡쳐해 보자.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
namespace CS
{
class Program
{
static void Main(string[] args)
{
Bitmap screen = GetScreen();
screen.Save("screen.png", System.Drawing.Imaging.ImageFormat.Png);
}
static Bitmap GetScreen()
{
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(bitmap);
g.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
g.Dispose();
return bitmap;
}
}
}
|
소스를 입력하고 빌드한다.
반응형