[c#]打印对话框,如何访问printdialog上的按钮? [英] [c#] Print Dialog, how to access buttons on printdialog?

查看:65
本文介绍了[c#]打印对话框,如何访问printdialog上的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.我想访问按钮上的打印"对话框中的打印"并隐藏它,因此它仅是取消"和应用"按钮.
2.用户单击应用"按钮后,以隐藏/关闭打印对话框.

其他信息已从下面的评论中移出
我正在使用包含打印",取消"和应用"按钮的对话框.不管您的操作系统是什么.

我尝试过类似的操作:

 Button btP =(Button)printDialog1.Container.Components [" ]; 



但是有错误:printDialog1.Container is null

我找不到按钮的名称,...在printdialog上. ,很愚蠢的想法.

当然,在我的系统(普通Win7)上,由PrintDialog.ShowDialog生成的对话框不包含应用"按钮-仅包含确定"和取消",因此禁用或隐藏打印"按钮将不起作用. >
如果您需要一个可以自定义的对话框,那么我强烈建议您创建自己的对话框,而不要依赖于入侵将来可能不存在的功能.


打印,取消,申请?我什至在我的PrintDialog上都没有.

但是也许有关黑客FontDialog 的这篇文章可以帮助您入门.但我强烈建议您创建自己的PrintDialog [此处 [此处 [ ^]
用于隐藏按钮并显示它们,您可以应用按钮的show和hide属性.

希望对您有所帮助


1. I want to access the button Print on printdialog and to hide it, so it will only be buttons Cancel and Apply.
2. After user click`s the button Apply, to hide/close printdialog.

additional information moved from comment below
I am using the dialog that contains buttons Print, Cancel and Apply. Regardless to your operating system.

I tried something like:

Button btP = (Button)printDialog1.Container.Components["Print"];



but there`s error: printDialog1.Container is null

I can`t find the names of the buttons,... on printdialog.

解决方案

That''s not going to be easy, and it may be a very, very silly idea.

Certainly, on my system (vanilla Win7) the dialog that results from PrintDialog.ShowDialog contains no "Apply" button - just "OK" and "Cancel" so disabling or hiding the "Print" button won''t work.

If you need a dialog that you can customise, then I would strongly suggest creating your own, rather than relying on hacking into features which may not be there in the future.


Print, Cancel, Apply? I don''t even have that on my PrintDialog.

But maybe this articlel on hacking FontDialog can get you started. But I strongly suggest you create your own PrintDialog[^]


This may help you to use print dialog and access the printing here[^]

And for button apply action you can use runtime events control of button here is a sample here[^]
for hiding buttons and showing them you can apply show and hide property of buttons.

I hope it helps you a bit


这篇关于[c#]打印对话框,如何访问printdialog上的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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