简体   繁体   English

如何为不公开PrintDocument对象的C#对象实现打印预览功能?

[英]How can I implement a Print Preview function for a C# object that doesn't expose a PrintDocument object?

[Disclaimer: I looked at the related questions and could only find relevant material for MFC. [免责声明:我查看了相关问题,只能找到与MFC相关的材料。 I don't do C++] 我不做C ++]

I've got a C# .Net app that uses a OCX control via interop (the control being a viewer component for CGM images). 我有一个C#.Net应用程序,该应用程序通过互操作使用OCX控件(该控件是CGM图像的查看器组件)。 The control exposes a Print() and PrintSetup() method but not a PrintPreview() method. 该控件公开一个Print()和PrintSetup()方法,但不公开一个PrintPreview()方法。

There's also no exposed PrintDocument object that I can use to implement this functionality. 也没有可用于实现此功能的公开PrintDocument对象。

Are there any other ways in which I can redirect to a Print Preview dialog? 还有其他方法可以重定向到“打印预览”对话框吗?

[More info]In case it helps someone answer, the control in question is the Larson CGM Viewer ActiveX, also referred to as VisEx CGM. [更多信息]如果它可以帮助某人回答,则有问题的控件是Larson CGM Viewer ActiveX,也称为VisEx CGM。 See http://www.cgmlarson.com/industry/cgm_viewer_control.php 参见http://www.cgmlarson.com/industry/cgm_viewer_control.php

您可以使用OCX控件将CGM图像作为临时文件保存到临时位置,然后使用winforms内置的PrintPreviewControl功能吗?

In the end I spoke to the vendor - they have a desktop product that they use their own control in (aka eating their own dogfood) and even they don't have Print Preview functionality. 最后,我与供应商交谈-他们有一个台式机产品,他们使用自己的控件(也就是吃自己的狗粮),甚至没有打印预览功能。

I'm not gonna jump through hoops to get a feature even the vendor doesn't provide or support - much as I hate telling end users something can't be done. 即使供应商不提供或支持,我也不会跳过以获得功能,这就像我讨厌告诉最终用户无法完成的事情一样。

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

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