0

I have written code in vb .net to take a screenshot of the screen. It captures the screen, but it doesn't capture mouse pointer. My code is below

Private Sub Take_Clip()

    Dim graph As Graphics
    Dim bnd As Rectangle = My.Computer.Screen.Bounds

    Dim SS As Bitmap
    SS = New Bitmap(bnd.Width, bnd.Height, Imaging.PixelFormat.Format32bppArgb)
    graph = Graphics.FromImage(SS)
    graph.CopyFromScreen(0, 0, 0, 0, bnd.Size)

End Sub

How to modify this code to capture mouse pointer also?

4
  • 3
    Feature, not a bug. If you want a cursor in the image then you have to draw it yourself. Use the Cursor.Draw() method. Commented Jan 14, 2017 at 12:58
  • @HansPassant : Cursor.Draw() will just draw the default cursor, not the currently active one. You can get around this by using a few WinAPI calls. Commented Jan 15, 2017 at 10:09
  • Possible duplicate of Include mouse cursor in screen capture using SharpDX Commented Jan 15, 2017 at 10:10
  • The answer in the duplicate above is written using the regular .NET methods, so just ignore the fact that the question is about SharpDX. :) Commented Jan 15, 2017 at 10:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.