Realice una captura de pantalla del control del navegador web en el hilo

Estoy usando la técnica mostrada en

Control WebBrowser en un nuevo hilo

Tratando de obtener un raspado de la pantalla de una página web, he podido obtener el siguiente código para que funcione correctamente cuandoWebBrowser el control se coloca en unWinForm. Sin embargo, falla al proporcionar una imagen arbitraria del escritorio cuando se ejecuta dentro de un hilo.

Thread browserThread = new Thread(() =>
{
    WebBrowser br = new WebBrowser();
    br.DocumentCompleted += webBrowser1_DocumentCompleted;
    br.ProgressChanged += webBrowser1_ProgressChanged;
    br.ScriptErrorsSuppressed = true;
    br.Navigate(url);
    Application.Run();
});
browserThread.SetApartmentState(ApartmentState.STA);
browserThread.Start();

private Image TakeSnapShot(WebBrowser browser)
{
    int width;
    int height;

    width = browser.ClientRectangle.Width;
    height = browser.ClientRectangle.Height;

    Bitmap image = new Bitmap(width, height);

    using (Graphics graphics = Graphics.FromImage(image))
    {
        Point p = new Point(0, 0);
        Point upperLeftSource = browser.PointToScreen(p);
        Point upperLeftDestination = new Point(0, 0);

        Size blockRegionSize = browser.ClientRectangle.Size;
        blockRegionSize.Width = blockRegionSize.Width - 15;
        blockRegionSize.Height = blockRegionSize.Height - 15;
        graphics.CopyFromScreen(upperLeftSource, upperLeftDestination, blockRegionSize);
    }

    return image;
}

Esto obviamente sucede debido al métodoGraphics.CopyFromScreen() pero no soy consciente de ningún otro enfoque. ¿Hay alguna manera de resolver este problema que alguien pueda sugerir? o ¿es mi única opción crear un formulario, agregar el control, hacerlo visible y luego borrar la pantalla? Por razones obvias, espero evitar tal enfoque.

Respuestas a la pregunta(2)

Su respuesta a la pregunta