我在 c# 中使用 microsoft 报告查看器生成了报告。
为了在横向视图中打印报告,我使用了代码:
reportViewer1.PrinterSettings.DefaultPageSettings.Landscape = true;
我将这段代码放在Form Load
Event 和 Event 上reportviewer load
,如下所示:
private void BillPDF_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dsBillPDF.totalBill' table. You can move, or remove it, as needed.
this.totalBillTableAdapter.Fill(this.dsBillPDF.totalBill,AllBill.fromDate);
reportViewer1.PrinterSettings.DefaultPageSettings.Landscape = true;
this.reportViewer1.RefreshReport();
}
private void reportViewer1_Load(object sender, EventArgs e)
{
reportViewer1.PrinterSettings.DefaultPageSettings.Landscape = true;
}
不幸的是,这段代码不起作用。
的用法reportViewer1.PrinterSettings.DefaultPageSettings.Landscape = true;
是错误的吗?或者我写错了位置。
请帮我。