注意 |
---|
重要说明: .NET Client Profile Framework 不支持此功能。 要在最终用户的机器上使用此功能,则必须安装完整的 .NET Framework。 更多信息,请参阅 Windows 窗体部署 文档中的 关于 .NET Framework 4.0 Client Profile 的重要说明 小节。 |
这个示例展示了如何定制 最终用户设计器 中的停靠面板 —— Report Explorer(报表资源管理器)、Field List(字段列表)、Group and Sort(分组和排序)、Scripts Errors(脚本错误) 和属性网格。
要这样做,首先需要创建 XRDesignForm 类的一个实例。 然后,可以通过窗体的 XRDesignForm.DesignDockManager 的 XRDesignDockManager.Item 属性获取任意停靠面板。
为了使此示例能正确地工作,应该把所有 必需的程序集 (包括 XtraReports.v10.2.Extensions 和 XtraBars.v10.2) 添加到项目的 引用 列表中。 并且 XtraReport1 类(派生于 XtraReport 类) 应该存在于示例应用程序中。
C# | 复制代码 |
---|---|
using System; using System.Windows.Forms; using DevExpress.XtraBars.Docking; using DevExpress.XtraReports.UserDesigner; // ... private void button1_Click(object sender, EventArgs e) { // Create an End-User Designer form. XRDesignForm designForm = new XRDesignForm(); // Open a new blank report in it. designForm.OpenReport(new XtraReport1()); // Customize the Group and Sort panel. GroupAndSortDockPanel groupSort = (GroupAndSortDockPanel)designForm.DesignDockManager[DesignDockPanelType.GroupAndSort]; groupSort.Visibility = DockVisibility.AutoHide; // Customize the Script Errors panel. ErrorListDockPanel errorList = (ErrorListDockPanel)designForm.DesignDockManager[DesignDockPanelType.ErrorList]; errorList.Visibility = DockVisibility.AutoHide; // Customize the Field List panel. FieldListDockPanel fieldList = (FieldListDockPanel)designForm.DesignDockManager[DesignDockPanelType.FieldList]; fieldList.ShowNodeToolTips = false; fieldList.ShowParametersNode = false; // Customize the Report Explorer panel. ReportExplorerDockPanel reportExplorer = (ReportExplorerDockPanel)designForm.DesignDockManager[DesignDockPanelType.ReportExplorer]; reportExplorer.CollapseAll(); // Customize the Property Grid panel. PropertyGridDockPanel propertyGrid = (PropertyGridDockPanel)designForm.DesignDockManager[DesignDockPanelType.PropertyGrid]; propertyGrid.ShowCategories = false; propertyGrid.ShowDescription = false; // Show the End-User Designer form. designForm.ShowDialog(); } |
Visual Basic | 复制代码 |
---|---|
Imports System Imports System.Windows.Forms Imports DevExpress.XtraBars.Docking 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. Dim designForm As New XRDesignForm() ' Open a new blank report in it. designForm.OpenReport(New XtraReport1()) ' Customize the Group and Sort panel. Dim groupSort As GroupAndSortDockPanel = _ CType(designForm.DesignDockManager(DesignDockPanelType.GroupAndSort), GroupAndSortDockPanel) groupSort.Visibility = DockVisibility.AutoHide ' Customize the Script Errors panel. Dim errorList As ErrorListDockPanel = _ CType(designForm.DesignDockManager(DesignDockPanelType.ErrorList), ErrorListDockPanel) errorList.Visibility = DockVisibility.AutoHide ' Customize the Field List panel. Dim fieldList As FieldListDockPanel = _ CType(designForm.DesignDockManager(DesignDockPanelType.FieldList), FieldListDockPanel) fieldList.ShowNodeToolTips = False fieldList.ShowParametersNode = False ' Customize the Report Explorer panel. Dim reportExplorer As ReportExplorerDockPanel = _ CType(designForm.DesignDockManager(DesignDockPanelType.ReportExplorer), ReportExplorerDockPanel) reportExplorer.CollapseAll() ' Customize the Property Grid panel. Dim propertyGrid As PropertyGridDockPanel = _ CType(designForm.DesignDockManager(DesignDockPanelType.PropertyGrid), PropertyGridDockPanel) propertyGrid.ShowCategories = False propertyGrid.ShowDescription = False ' Show the End-User Designer form. designForm.ShowDialog() End Sub |
Show Me |
---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E913。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |