效果
在这里我们用的是 ScreenCapturerSharp库,要在nuget里面安装,或直接引用它的dll
核心代码
private void button1_Click(object sender, EventArgs e) { this.Hide(); System.Threading.Thread.Sleep(200); ScreenCapturer.ScreenCapturerTool screenCapturer = new ScreenCapturer.ScreenCapturerTool(); if (screenCapturer.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Bitmap bmp = (Bitmap)screenCapturer.Image; pictureBox1.Image = bmp; } this.Show(); }
源码下载地址 https://pan.baidu.com/s/1lCd8yNY4OGvo8-ISLhUMUA?pwd=h1va
本文来自 www.luofenming.com