SoFunction
Updated on 2025-03-01

Example of scrolling web page screenshot function implemented by C#

This article describes the scrolling web page screenshot function implemented by C#. Share it for your reference, as follows:

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
namespace WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
    private int _currentWidth = 1024;
    private Bitmap _currentBitmap = null;
    public Form1()
    {
      InitializeComponent();
    }
private void button1_Click(object sender, EventArgs e)
{
  if ( == null)
    return;
  try
  {
    int width = _currentWidth;
    int height = ;
     = width;
     = height;
    _currentBitmap = new Bitmap(width, height);
    ();
    (_currentBitmap, new Rectangle(0, 0, width, height));
     = _currentBitmap;
  }
  catch (Exception ex)
  {
    ((), "Escaped an error", , );
  }
}
  }
}

For more information about C#, please visit the special topic of this site:Summary of C# picture operation skills》、《Tutorial on the usage of common C# controls》、《Summary of WinForm control usage》、《C# data structure and algorithm tutorial》、《Introduction to C# object-oriented programming tutorial"and"Summary of thread usage techniques for C# programming

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