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、右鍵點選引用
2、添加引用
3、點選浏覽,找到對應的包件FastReport.dll,包件在FastReport的安裝目錄下
4、引用好包件後就可以用代碼:FastReport.Report report1 = new FastReport.Report();建立report1 執行個體了。以下是添加代碼樣闆: