天天看点

c#FastReport打印机设置,设置打印机名

c#FastReport打印机设置,设置打印机名(FastReport版本 2013.2.5)

以下是FastReport打印机名设置的代码

//*************************************************************************

void setprint()//这是一个方法

{

DialogResult Resultm = printDialog1.ShowDialog();

report1.PrintSettings.Printer = printDialog1.PrinterSettings.PrinterName;//这句是打印机设置

label9.Text = “当前打印机:” + printDialog1.PrinterSettings.PrinterName;

label9.Left = comboBox1.Left - label9.Width - 3;

if (Resultm == DialogResult.OK)
        {
            printm();
            //MessageBox.Show("点了取消");
        }

    }
           

//*******************************************************************************

说明:实现FastReport打印机设置的前提条件,加打印机对话框printDialog控件,第1次添加时控件名称为printDialog1;添加report控件,添加report控件实例有两种方法,通过代码添加及通过工具箱添加,代码添加方法:FastReport.Report report1 = new FastReport.Report();当然,用代码添加首先得引入相应的包件,包件引用方法为

1、右键点击引用

c#FastReport打印机设置,设置打印机名

2、添加引用

c#FastReport打印机设置,设置打印机名

3、点击浏览,找到对应的包件FastReport.dll,包件在FastReport的安装目录下

c#FastReport打印机设置,设置打印机名
c#FastReport打印机设置,设置打印机名

4、引用好包件后就可以用代码:FastReport.Report report1 = new FastReport.Report();创建report1 实例了。以下是添加代码样板:

c#FastReport打印机设置,设置打印机名