In my last article, I describe how to use the Win32 API to capture screenshots of the desktop. There was one frustrating problem with this however - when capturing an image based on the value of the
Bounds property of a
Form unexpected values were returned for the left position, width and height of the window, causing my screenshots to be too big.
I thought that was odd but as I wanted to be able to capture unmanaged windows in future then using
Form.Bounds wasn't going to be possible anyway and I would have to use
GetWindowRect. I'm sure that deep down in the Windows Forms code base it uses the same API so I was expecting to get the same "wrong" results, and I wasn't disappointed.