打印预览对话框和Mdi表单 [英] Print preview dialog and Mdi form

查看:76
本文介绍了打印预览对话框和Mdi表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的团队,

我在printpreview对话框中有一个printdocument页面,这是vb.net中的mdi子窗体。
当我关闭mdiform(mdiparent)时
每次调用printdocuments beginprint / printpage事件时,每次调用mdi close方法时,我们都可以停止这种行为。



在printdocument构造函数中我通过了菜单上的Mdi_Form

单击mdi表单我调用构造函数和构造函数代码如下

Dim PrintDialog1作为新的PrintPreviewDialog

PrintDialog1.Document = PrintDocument'PrintDialog与PrintDocument相关联。

PrintDialog1.mdiparent = mdiform

PrintDialog1.Show()





和打印所需的所有代码都在

Print_Doc ---- Begin_print和Print_Page事件



工作正常,但当我关闭mdi表单时,它再次只调用这些事件

Print_Doc ---- Begin_print和Print_Page活动

谢谢

Sukhen Dass

解决方案

这是一个想法:谁需要MDI?为什么要折磨自己并吓跑你的用户?

帮自己一个大忙:根本不要使用MDI。没有它,您可以更轻松地实现设计,质量更好。 MDI甚至被微软高度劝阻,事实上,微软将其从WPF中删除并且很难支持它。更重要的是,如果您使用MDI,您将吓跑所有用户。只是不要。请参阅:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [ ^ ],

如何在WPF中创建MDI父窗口? [ ^ ]。



我可以解释做什么。请看我过去的答案:

如何在WPF中创建MDI父窗口? [解决方案2 ],

关于在WPF中使用MDI窗口的问题 [ ^ ],

麦当劳给出错误 [ ^ ],

如何设置子窗体最大化,最后一个子窗体最小化 [ ^ ]。



-SA

Dear Team,
I have a printdocument page in printpreview dialog and which is a mdi child form in vb.net.
when i close the mdiform(mdiparent) every time it is calling the printdocuments beginprint/printpage event again and every time the mdi close method is called,can we stop doing this behavior.

in printdocument constructor i passed the Mdi_Form
on menu click in mdi form i called the constructor and constructor code is below
Dim PrintDialog1 as new PrintPreviewDialog
PrintDialog1.Document = PrintDocument 'PrintDialog associate with PrintDocument.
PrintDialog1.mdiparent=mdiform
PrintDialog1.Show()


and all the required codes for printing is in
Print_Doc----Begin_print and Print_Page event

its working fine but when i closed the mdi form it again call only these events
Print_Doc----Begin_print and Print_Page event
Thanks
Sukhen Dass

解决方案

Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].

I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA


这篇关于打印预览对话框和Mdi表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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