如何在c#中使用滚动条截取Windows窗体的屏幕截图 [英] How to take screen shot of Windows Form with Scroll Bar in c#

查看:131
本文介绍了如何在c#中使用滚动条截取Windows窗体的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Windows 窗体应用程序.

I have a windows form application.

表格很大&有滚动条可以查看其全部内容.

The form is large & has scroll bars to view its entire content.

我需要截取整个表单的屏幕截图(包括由于表单高度而超出屏幕的区域).

I need to take the screen shot of the entire form(including the area which is outside of screen due to the forms height).

我尝试了以下代码,但它只捕获了屏幕上可见的表单部分:

I tried following code, but it captures only the part of the form which is visible on screen:

ScreenCapture sc = new ScreenCapture();
// capture entire screen, and save it to a file
Image img = sc.CaptureScreen();
// display image in a Picture control named imageDisplay
this.imageDisplay.Image = img;
// capture this window, and save it
sc.CaptureWindowToFile(this.Handle,"C:\\temp2.gif",ImageFormat.Gif);

我无法截取整个表单的屏幕截图.

I am not able to take screen shot of the entire Form.

谁能告诉我捕获整个表单的方法,包括由于滚动而隐藏的区域?

Can anybody please let me know the way to capture the entire form including the area which is hidden due to scroll?

推荐答案

您是否尝试使用 Control.DrawToBitmap 可以在表单上使用,也可以在表单中的特定控件上使用.

Did you try using Control.DrawToBitmap you can use it on the form as well as specific controls in the form.

这篇关于如何在c#中使用滚动条截取Windows窗体的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆