本文介绍了VB.net打印???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我是vb.net的中级程序员,我注意到从VB进行打印的方法几乎只有两种:使用printdocument选项和使用printform选项. Printform显然会截取屏幕上可见的窗口的屏幕截图 (如果有多个用户正在使用我的程序,并且都使用不同的分辨率,那么这可能是一场噩梦,因为屏幕较小/分辨率较低的用户在打印时无法捕获整个窗口.)我基本上只有一个窗口作为报告 带有需要打印的标签,文本框和面板(功能非常强大,看起来不错).当分辨率良好时,printform效果很好,但这不是长期解决方案.我认为printdocument是我的答案,但正如我所研究的那样,它似乎太复杂了 几个小时就可以了.据我了解,printdocument具有某种能力,即使它不可见,也可以捕获按钮,列表框,标签等窗口上的所有内容,并将其打印到要在打印机上打印的页面上,但是我不确定是否就是这种情况. 我的主要问题是,您建议我使用什么来打印单个窗口中存在的所有内容,其中可能包含屏幕上看不到的区域?并且不会有一个特定的编码示例可用于多个程序,具体取决于 窗口大小?这非常令人沮丧,其他论坛上的几个人都忽略了这个问题,这意味着它太难了,或者他们都不知道……希望您能提供帮助.非常感谢.

I'm an intermediate programmer in vb.net and i've noticed there are pretty much only two ways to print from VB: using the printdocument option and using the printform option. Printform obviously takes a screenshot of the window that is visible on screen (which if multiple users are using my program and are all on different resolutions, that can be a nightmare as users with smaller screens / smaller resolutions doesn't capture the full window when printing.) i basically have one single window that is a report with labels, text boxes, and panels (it's very vibrant and looks nice) that i need to print. printform does great when resolution is good but this is not a long term solution. I think printdocument is my answer but it seems so complicated as i've researched for hours on it. from what i understand, printdocument has some sort of ability to capture everything on a window like buttons, listboxes, labels, etc even if it isn't visible and plot it to a page to print on the printer but i'm not sure if that is the case. My main question is, what do you recommend i use to print everything that exists on a single window that might have areas that aren't viewable on screen?  And wouldn't there be a specific coded example that could be used across multiple programs depending on window size?  This was has been super frustrating and several people on other forums have ignored this question which means it's either too hard or they just don't know either...hoping you can help.  Much appreciated.

推荐答案

并不是我已经尝试过此方法,但是如果遇到您的情况,我可能会研究编码一种方法,以将Form抓取为图像并将其用于打印,也许可以对其进行适当缩放.

Not that I have tried this, but if faced with your situation, I might investigate coding a means to grab the Form as an image and use that for printing, perhaps scaling it appropriately.

如果听起来可行,那么 TommyTwoTrain 应该很快就会实现这一目标.

If that sound feasible, then TommyTwoTrain should be along sometime soon to go into a way to achieve that.

(注意:可以使用其他学识渊博的贡献者)

(NOTE: other well learned contributers are available)


这篇关于VB.net打印???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:04