所有的工具栏按钮(包括与其对应的菜单项)均可通过改变对象打印系统的命令(参考DevExpress.XtraPrinting.PrintingSystemCommand的枚举项列表)将其显示/隐藏。要实现该操作可通过PrintingSystem.SetCommandVisibility 方法完成。参考代码如下:
using System;
using System.Windows.Forms;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...
private void button1_Click(object sender, EventArgs e) {
//创建报表示例,指定到一个打印工具
ReportPrintTool pt = new ReportPrintTool(new XtraReport1());
// 获取打印工具的PrintingSystem
PrintingSystemBase ps = pt.PrintingSystem;
// 隐藏Watermark 工具按钮和菜单项.
if (ps.GetCommandVisibility(PrintingSystemCommand.Watermark) != CommandVisibility.None) {
ps.SetCommandVisibility(PrintingSystemCommand.Watermark,
CommandVisibility.None);
}
// 显示Document Map工具按钮和菜单项
ps.SetCommandVisibility(PrintingSystemCommand.DocumentMap, CommandVisibility.All);
//显示报表预览.
pt.ShowPreview();
}
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/122.html