以某部分隐藏窗口的截图以编程的方式截图、窗口、方式

2023-09-04 00:45:27 作者:卖萌的小行家

是否有可能得到一个窗口,是不是顶部,即如果一部分被另一个窗口的截图,没有把它顶端?

Is it possible to get a screenshot of a window that is not on the top, i.e. if it is partially hidden by another window, without bringing it to the top?

推荐答案

您不需要采取截图,如果你的应用程序,你可以使用 Control.DrawToBitmap(位图位图,矩形targetBounds); 。

You dont need to take screenshot, if it is your application you can use Control.DrawToBitmap(Bitmap bitmap, Rectangle targetBounds); of the form object.

如果是其他应用程序窗口,你可以尝试取消管理的方式来获得窗口的UI。我不记得所有的方法,但我已尽力,这是工作。也许 GetWindow SendMesage WM_PRINT / WM_PRINTCLIENT

If it is other application window, you can try un-managed way to get the UI of window. I dont remember all the methods but I have tried and it was working. Probably GetWindow and SendMesage with WM_PRINT / WM_PRINTCLIENT