如何在C#windows应用程序中设置打印机设置 [英] How to set printer setting prgrammically in C# windows application

查看:132
本文介绍了如何在C#windows应用程序中设置打印机设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,我必须在点阵打印机上打印发票复印件(8.5 * 11英寸)和交货(一半尺寸的一半)(8.5 * 6英寸)

。我想在同一个点阵打印机上打印。如何为报告提供打印机设置。

i我正在使用c#窗口应用程序。



我尝试过:



System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();

pg.Margins.Top = 1;

pg.Margins.Bottom = 1;

pg.Margins.Left = 1;

pg.Margins.Right = 1 ;

System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize();

size.PaperName =Custom;

reportViewer1.SetPageSettings(pg);

my problem was, i have to print invoice copy(8.5*11 inch) and delivery(half of a4 size )(8.5 * 6 inch)
in dot matrix printer. I want to print both in same dot matrix printer. how to give printer setting fro both report .
i am using c# window application.

What I have tried:

System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
pg.Margins.Top = 1;
pg.Margins.Bottom = 1;
pg.Margins.Left = 1;
pg.Margins.Right = 1;
System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize();
size.PaperName = "Custom";
reportViewer1.SetPageSettings(pg);

推荐答案

您的 PaperSize尺寸未连接到 PageSettings页面。将一个附加到另一个。
Your PaperSize size is not connected to PageSettings pg. Attach one to the other.
size.PaperName = "Custom";
pg.PaperSize = size;
reportViewer1.SetPageSettings(pg);


浏览以下链接。



点击此处


这篇关于如何在C#windows应用程序中设置打印机设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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