1

Hi I have a function in c# to get a screenshot of poor quality so that the image does not weigh much, I have it all figured out but the problem is that the screenshot does not see the mouse cursor.

the code is this:

    int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
    int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
    Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
    Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
    gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
    bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);

as I solve this problem?

Ryan
  • 26,884
  • 9
  • 56
  • 83
user3692208
  • 39
  • 1
  • 2
  • 8
  • AFAIK, you'll have to add it yourself. Maybe [this question](http://stackoverflow.com/questions/918990/c-sharp-capturing-the-mouse-cursor-image) can help. – Pierre-Luc Pineault May 30 '14 at 20:16

1 Answers1

5

You need to draw the cursor on the image on your own. The system will not capture it since it is drawn in low-level driver.

To draw it at first you need to get cursor image itself from system's mouse settings as a cur file. Also you will need a current cursor type (hand, resize, etc) and its position at the moment of taking a screenshot.

AgentFire
  • 8,944
  • 8
  • 43
  • 90