SoFunction
Updated on 2025-03-07

Methods for implementing screen copying in C#

This article describes the method of C# to implement screen copying. Share it for your reference. The details are as follows:

Method 1:

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using .Drawing2D;
namespace WindowsApplication2
{
  public partial class Form21 : Form
  {
    public Form21()
    {
      InitializeComponent();
    }
    private void button1_Click(object sender, EventArgs e)
    {
      Rectangle screenRect = ;
      Bitmap dumpBitmap = new Bitmap(, );
      Graphics tg = (dumpBitmap);
      (0, 0, 0, 0, new Size(, ));
      this. = dumpBitmap;
      this. = ;
      (@"c:/");
    }
  }
}

Method 2:

using System;
using ;
using ;
using ;
using ;
using ;
using ;
namespace WindowsApplication2
{
  public partial class Form22 : Form
  {
    public Form22()
    {
      InitializeComponent();
    }
    private void button1_Click(object sender, EventArgs e)
    {
      Rectangle rect = new Rectangle(0, 0, , );
      Bitmap dumpBitmap = new Bitmap(, );
      (dumpBitmap, rect);
      this. = dumpBitmap;
      this. = ;
      (@"c:/");
    }
  }
}

I hope this article will be helpful to everyone's C# programming.