简体   繁体   English

程序VB.net的打印屏幕截图

[英]Print Screen Shot of Program VB.net

Is there anyway to print out a screen shot of my program? 无论如何,有没有要打印我的程序的屏幕截图? Like... when I press the print button, it will print out a screenshot of the program? 就像...当我按下“打印”按钮时,它将打印出程序的屏幕截图吗? I have attached a picture of how it looks... I have a regular print out, but need the screen shot as well. 我已经附上了一张图片,看起来...我有常规打印,但也需要屏幕截图。

Thanks in advance, 提前致谢,

在此处输入图片说明

Add the PrintForm component to your form: PrintForm组件添加到您的表单:

在此处输入图片说明

Add a button with the following code: 添加具有以下代码的按钮:

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
    PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
    PrintForm1.Print()
End Sub

Done. 完成。

Save form as image (screenshot) 将表单另存为图像(屏幕截图)

The above works. 以上作品。 I tried it, and had a slight issue with it capturing the full size of my form but starting below the title bar and extending beyond that. 我尝试了一下,但在捕获表单的全部大小时遇到​​了一个小问题,但是从标题栏下方开始,然后扩展到该范围之外。 you'd just need to change the new point to -X (X being the size of title bar and border of form). 您只需要将新点更改为-X(X是标题栏的大小和表单边框)。 That make sense? 有道理?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM