Developer Express 之 XtraReport报表预览控件PrintControl设置
本帖最后由 lmhtingna 于 2014-4-22 10:08 编辑代码如下:
view sourceprint?
01 using System;
02 using System.Collections.Generic;
03 using System.ComponentModel;
04 using System.Data;
05 using System.Drawing;
06 using System.Text;
07 using System.Windows.Forms;
08 using DevExpress.XtraEditors;
09 using DevExpress.XtraReports.UI;
10 using DevExpress.XtraPrinting.Preview;
11 using DevExpress.XtraPrinting;
12 using DevExpress.XtraPrinting.Control;
13
14 namespace WFAXtraReport
15 {
16 public partial class Form1 : Form
17 {
18 public Form1 ()
19 {
20 InitializeComponent();
21 }
22
23 private void Form1 _Load(object sender, EventArgs e)
24 {
25
26 XtraReport fXtraReport = new XtraReport();
27 //fXtraReport.LoadLayout(@"C:\1.repx");
28
29 PrintControl printControl1 = new PrintControl();
30 printControl1.PrintingSystem = fXtraReport.PrintingSystem;
31
32
33 PrintBarManager printBarManager = new PrintBarManager();
34 printBarManager.Form = printControl1;
35 printBarManager.Initialize(printControl1);
36 printBarManager.MainMenu.Visible = false;
37 printBarManager.AllowCustomization = false;
38
39 //操作要显示什么按钮
40 printControl1.PrintingSystem.SetCommandVisibility(new PrintingSystemCommand[]{
41 PrintingSystemCommand.Open,
42 PrintingSystemCommand.Save,
43 PrintingSystemCommand.ClosePreview,
44 PrintingSystemCommand.Customize,
45 PrintingSystemCommand.SendCsv,
46 PrintingSystemCommand.SendFile,
47 PrintingSystemCommand.SendGraphic,
48 PrintingSystemCommand.SendMht,
49 PrintingSystemCommand.SendPdf,
50 PrintingSystemCommand.SendRtf,
51 PrintingSystemCommand.SendTxt,
52 PrintingSystemCommand.SendXls
53 }, CommandVisibility.None);
54
55 fXtraReport.CreateDocument();
56
57 Controls.Add(printControl1);
58 printControl1.Dock = DockStyle.Fill;
59 }
60 }
61 }
关于XtraReport的功能还有很多,细节上的处理还有很多,留待以后再整理,先整理这几个常用的
页:
[1]