C# 屏幕截图

使用 ScreenCapturer.dll

ScreenCapturer: 一个NET 下的截图工具,支持多屏幕下的截图功能,支持全屏或者指定区域截图,说手动或自动截图。

Demo

代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

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

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            ScreenCapturer.Wait.Delay(200);
            ScreenCapturer.ScreenCapturerTool screenCapturer = new ScreenCapturer.ScreenCapturerTool();
            if (screenCapturer.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Bitmap bmp = (Bitmap)screenCapturer.Image;
                pictureBox1.BackgroundImage = bmp;
            }
            this.Show();
        }
    }
}

 效果

Demo下载

posted @ 2023-02-17 09:48  天天代码码天天  阅读(141)  评论(0编辑  收藏  举报  来源