1

I am try Try capture an image of an particular area in my webpage. Below code works fine but issue is it gives me only a blank image with a size of 1.64kb every time.

Function call

 protected void btn_Click(object sender, EventArgs e)
        {
            System.Drawing.Image image = CaptureScreen(50, 99, 930, 450);
            image.Save(Server.MapPath("/img/screen.jpg"));
        }

Function Definition

public System.Drawing.Image CaptureScreen(int sourceX, int sourceY, int destX, int destY)
        {
            Bitmap bmp = new Bitmap(930, 430);
            Graphics g = Graphics.FromImage(bmp);
            Size xx=new Size();
            xx.Width=930;
            xx.Height=450;
            g.CopyFromScreen(sourceX, sourceY, destX, destY, xx);
            return bmp;
        }
  • 1
    Please refer to this article: http://10rem.net/blog/2011/02/08/capturing-screen-images-in-wpf-using-gdi-win32-and-a-little-wpf-interop-help – Koby Douek Apr 18 '17 at 09:59

0 Answers0