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?

MrGadget
  • 1,258
  • 1
  • 10
  • 19
Sai
  • 23
  • 7
  • 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. – Hans Passant Jan 14 '17 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. – Visual Vincent Jan 15 '17 at 10:09
  • Possible duplicate of [Include mouse cursor in screen capture using SharpDX](http://stackoverflow.com/questions/38163667/include-mouse-cursor-in-screen-capture-using-sharpdx) – Visual Vincent Jan 15 '17 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. :) – Visual Vincent Jan 15 '17 at 10:21

0 Answers0