tijian_jichuang/Code/KeFu/frmPiLiangDaoChu.cs

71 lines
1.9 KiB
C#
Raw Normal View History

2025-02-20 11:54:48 +08:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FastReport.Export.Pdf;
namespace SOH.KeFu
{
public partial class frmPiLiangDaoChu : Form
{
public frmPiLiangDaoChu()
{
InitializeComponent();
}
DataTable dt;
public bool showview = false;
public frmPiLiangDaoChu(DataTable dts)
{
dt = dts;
InitializeComponent();
}
public FastReport.Report re = new FastReport.Report();
public void init()
{
if (dt.Rows.Count != 0)
{
re.Load(Application.StartupPath + "\\Report\\tjztPldc.frx");
re.RegisterData(dt, "Table");
re.Preview = previewControl1;
}
}
public void print()
{
if (previewControl1.Report == null)
{
//MessageBox.Show("请先初始化数据!");
return;
}
if (showview)
{
if (!this.Visible)
{
this.Show();
//printpreview.Report.Show();
}
return;
}
//string printname = "";
//System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
//printname = cm.AppSettings.Settings["bgdyjmc"].Value;
//if (!string.IsNullOrEmpty(printname))
//{
// previewControl1.Report.PrintSettings.Printer = printname;
// }
previewControl1.Report.PrintSettings.ShowDialog = false;
previewControl1.Report.Print();
}
}
}