TWebBrowser 模态打印对话框?
我发现了很多方法可以使 TWebBrowser 显示非模式打印对话框,但是如何使其显示模式对话框呢?我想打印一个 html 页面,这就是我需要模式对话框的原因。
我非常感谢您对此的想法。
谢谢!
I've found many ways to make the TWebBrowser show a modeless print dialog box, but how do I make it show a modal one? I would like to print an html page, that's why I need the modal dialog.
I'd really appreciate your ideas on this one.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想不出为什么会有很多方法来显示非模式对话框。为什么在显示非模式打印对话框时您希望继续与 Web 浏览器交互?
如果您想通过程序启动打印,但需要用户选择打印机,请使用:
I cannot think of a reason why there would be lots of ways to show a modeless dialog. Why would you want to continue interacting with the web browser while a modeless print dialog is displayed?
If you want to initiate the print by program, but need the user to select the printer, use:
尤里卡!我解决了。
方法如下:
当显示无模式打印对话框时,您可以禁用 Delphi 中的调用窗体。然后,您可以使用 OnCommandStateChange 事件来检测用户何时打印或取消打印对话框。
示例代码:
我恳请大家测试我的解决方案,因为我不确定此代码的可靠性。
谢谢!
Eureka! I solved it.
Here is how:
When you show the modeless print dialog, you can disable the calling Form in Delphi. Then you can use the OnCommandStateChange event to detect when the user Prints or Cancels the Print dialog.
Example code:
I kindly ask you people to test my solution, as I'm not sure of the reliability of this code.
Thanks!