如何打印窗口表格 [英] how to print window form

查看:83
本文介绍了如何打印窗口表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我只想知道hoe用c#winform打印表格.实际上,我想在单击打印"按钮时打印其他表格.让我详细解释....
我有两种形式,即form1和form2.现在在form1上,我已经给出了打印按钮,并且在该按钮的click事件上,form2被打印为简单的单词页面.请帮助我.....

Hello everyone i just want to know hoe to print form in c# winform. Actually i want to print other form on click of print button. let me explain in detail....
I have two forms i.e. form1 and form2. now on form1 i have given print button and on the click event of this button form2 get printed as simple word page. plz help me out i m in need.....

推荐答案

如果您尝试打印Form2,我相信此代码将起作用:

http://msdn.microsoft.com/en-us/library/aa287529 (v = vs.71).aspx [
If you are attempting to print Form2, I believe this code will work:

http://msdn.microsoft.com/en-us/library/aa287529(v=vs.71).aspx[^]

You will probably need to bring Form2 to the foreground before running that code and you might need to put the actual code in the Form2 code behind.

I would recommend you get the Form printing to work first, and then try to expand it to be called from another form.


尝试一下
Process printjob = new Process();
printjob.StartInfo.UseShellExecute = true;
printjob.StartInfo.FileName = @"c:/test.jpg";
printjob.StartInfo.Verb = "print";
printjob.StartInfo.CreateNoWindow = true;
printjob.Start();


这篇关于如何打印窗口表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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