Perform screen-scape of Webbrowser control in thread

前端 未结 2 1391
抹茶落季
抹茶落季 2020-11-29 10:16

I am using the technique shown in

WebBrowser Control in a new thread

Trying to get a screen-scrape of a webpage I have been abl

2条回答
  •  借酒劲吻你
    2020-11-29 10:19

    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);
        }
    

    Do you really need using statement ?

    You also return image but how is copied image assigned to it?

提交回复
热议问题