듀얼 스크린 Capture

홈 > 공유팁! > 프로그램 관련
프로그램 관련

듀얼 스크린 Capture

꽁스짱 0 1376
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);
        }
    }
}
0 Comments
제목