整理的对PrintControl进行设置的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Preview;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Control;
namespace WindowsFormsApplication1
{
public partial class XtraForm2 : DevExpress.XtraEditors.XtraForm
{
public XtraForm2()
{
InitializeComponent();
}
private void XtraForm2_Load(object sender, EventArgs e)
{
XtraReport fXtraReport = new XtraReport();
//fXtraReport.LoadLayout(@"C:\1.repx");
PrintingSystem printingSystem1 = new PrintingSystem();
PrintControl printControl1 = new PrintControl();
printControl1.PrintingSystem = printingSystem1;
PrintBarManager printBarManager = new PrintBarManager();
printBarManager.Form = printControl1;
printBarManager.Initialize(printControl1);
printBarManager.MainMenu.Visible = false;
printBarManager.AllowCustomization = false;
printingSystem1.SetCommandVisibility(new PrintingSystemCommand[]{
PrintingSystemCommand.Open,
PrintingSystemCommand.Save,
PrintingSystemCommand.ClosePreview,
PrintingSystemCommand.Customize,
PrintingSystemCommand.SendCsv,
PrintingSystemCommand.SendFile,
PrintingSystemCommand.SendGraphic,
PrintingSystemCommand.SendMht,
PrintingSystemCommand.SendPdf,
PrintingSystemCommand.SendRtf,
PrintingSystemCommand.SendTxt,
PrintingSystemCommand.SendXls
}, CommandVisibility.None);
fXtraReport.PrintingSystem = printingSystem1;
fXtraReport.CreateDocument();
Controls.Add(printControl1);
printControl1.Dock = DockStyle.Fill;
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Preview;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Control;
namespace WindowsFormsApplication1
{
public partial class XtraForm2 : DevExpress.XtraEditors.XtraForm
{
public XtraForm2()
{
InitializeComponent();
}
private void XtraForm2_Load(object sender, EventArgs e)
{
XtraReport fXtraReport = new XtraReport();
//fXtraReport.LoadLayout(@"C:\1.repx");
PrintingSystem printingSystem1 = new PrintingSystem();
PrintControl printControl1 = new PrintControl();
printControl1.PrintingSystem = printingSystem1;
PrintBarManager printBarManager = new PrintBarManager();
printBarManager.Form = printControl1;
printBarManager.Initialize(printControl1);
printBarManager.MainMenu.Visible = false;
printBarManager.AllowCustomization = false;
printingSystem1.SetCommandVisibility(new PrintingSystemCommand[]{
PrintingSystemCommand.Open,
PrintingSystemCommand.Save,
PrintingSystemCommand.ClosePreview,
PrintingSystemCommand.Customize,
PrintingSystemCommand.SendCsv,
PrintingSystemCommand.SendFile,
PrintingSystemCommand.SendGraphic,
PrintingSystemCommand.SendMht,
PrintingSystemCommand.SendPdf,
PrintingSystemCommand.SendRtf,
PrintingSystemCommand.SendTxt,
PrintingSystemCommand.SendXls
}, CommandVisibility.None);
fXtraReport.PrintingSystem = printingSystem1;
fXtraReport.CreateDocument();
Controls.Add(printControl1);
printControl1.Dock = DockStyle.Fill;
}
}
}