📄 frmsubjectprint.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using property.control.Subject;
using property.model.SubjectInfo;
namespace property.view.HinderInfo
{
public partial class frmSubjectPrint : Form
{
public frmSubjectPrint()
{
InitializeComponent();
}
public string P_str_Name;//全局变量
public int P_int_subid;//全局变量
public frmSubjectPrint(string P_str_name)
{
InitializeComponent();
P_str_Name = P_str_name;
}
public frmSubjectPrint(int P_int_id)
{
InitializeComponent();
P_int_subid = P_int_id;
}
private void frmSubjectPrint_Load(object sender, EventArgs e)
{
GetSubject gs = new GetSubject();
SubInfo info = new SubInfo();
info.setsubId(P_int_subid);
if (P_int_subid!=0)
{
// string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
//Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
// reportPath += reportPath += @"\view\hinderInfo\crPtSujbect.rpt"; //获取报表路径
string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
reportPath += @"\view\hinderInfo\ptfrmSubject.rpt";
DataSet ds = gs.SubDataSet(P_int_subid);
ReportDocument rd = new ReportDocument();
rd.Load(reportPath);
rd.SetDataSource(ds.Tables[0].DefaultView);
this.crrView.ReportSource = rd;
}// end block if
else if (P_str_Name != null)
{
string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
reportPath += @"\view\hinderInfo\ptfrmSubject.rpt";
DataSet ds = gs.SubDataSet(P_str_Name);
ReportDocument rd = new ReportDocument();
rd.Load(reportPath);
rd.SetDataSource(ds.Tables[0].DefaultView);
this.crrView.ReportSource = rd;
}// end block if
else
{
string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
reportPath += @"\view\hinderInfo\ptfrmSubject.rpt";
DataSet ds = gs.SubDataSet();
ReportDocument rd = new ReportDocument();
rd.Load(reportPath);
rd.SetDataSource(ds.Tables[0].DefaultView);
this.crrView.ReportSource = rd;
}// end block if
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -