달력

52024  이전 다음

  • 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
  • 31
반응형
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyCapture
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            Rectangle rc = new Rectangle();
            foreach (var item in Screen.AllScreens)
            {
                rc = Rectangle.Union(rc, item.Bounds);
            }

            Bitmap bmp = new Bitmap(rc.Width, rc.Height);
            using (Graphics g = Graphics.FromImage(bmp))
            {                
                g.CopyFromScreen(rc.Location, Point.Empty, bmp.Size);
            }
            bmp.Save(@"sshot.png", ImageFormat.Png);
        }
    }
}

'프로그래밍 > C#' 카테고리의 다른 글

[C#]텍스트 배경 반반따로 그리기?  (0) 2019.07.17
[C#]이미지 크기 변경  (0) 2019.06.23
[C#]OpenCvSharp 이미지 로드  (0) 2019.02.05
[C#] 둥근 버튼  (0) 2019.01.12
[C#]파일 확장자로 구분해서 image 저장  (0) 2018.12.15
Posted by 유령회사
|