Note注意

重要说明: .NET Client Profile Framework 不支持此功能。 要在最终用户的机器上使用此功能,则必须安装完整的 .NET Framework。 更多信息,请参阅 Windows 窗体部署 文档中的 关于 .NET Framework 4.0 Client Profile 的重要说明 小节。

这个示例展示了如何改变 最终用户设计器 中的菜单项和 智能标记 项的可视性。 要这样做,需要使用 XRDesignPanel.SetCommandVisibility 方法。

下列代码隐藏了 New with Wizard(使用向导新建)... 菜单项和报表智能标记的 Design in Report Wizard(在报表向导中设计)... 操作项。 在 ReportCommand 枚举中列出了所有可用的报表命令。

C#CopyCode image复制代码
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UserDesigner;
//...

private void button1_Click(object sender, EventArgs e) {
    // Create an End-User Designer form instance.
    XRDesignForm designForm = new XRDesignForm();

    // Load a new blank report into it.
    designForm.OpenReport(new XtraReport1());

    // Hide the "New with Wizard..." item on the File menu,
    // and the "Design in Report Wizard..." item in the report's smart tag.
    designForm.ActiveDesignPanel.SetCommandVisibility(ReportCommand.NewReportWizard,
        CommandVisibility.None);
    designForm.ActiveDesignPanel.SetCommandVisibility(ReportCommand.VerbReportWizard,
        CommandVisibility.None);

    // Show the End-User Designer form.
    designForm.Show();
}
Visual BasicCopyCode image复制代码
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UserDesigner
'...

Private Sub button1_Click(ByVal sender As Object, _ 
ByVal e As EventArgs) Handles button1.Click
    ' Create an End-User Designer form instance.
    Dim designForm As New XRDesignForm()

    ' Load a new blank report into it.
    designForm.OpenReport(New XtraReport1())

    ' Hide the "New with Wizard..." item on the File menu,
    ' and the "Design in Report Wizard..." item in the report's smart tag.
    designForm.ActiveDesignPanel.SetCommandVisibility(ReportCommand.NewReportWizard, _ 
        CommandVisibility.None)
    designForm.ActiveDesignPanel.SetCommandVisibility(ReportCommand.VerbReportWizard, _ 
        CommandVisibility.None)

    ' Show the End-User Designer form.
    designForm.Show()
End Sub

CodeCentralShow Me

在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E203。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。

Expand image参阅