注意 |
---|
重要说明: .NET Client Profile Framework 不支持此功能。 要在最终用户的机器上使用此功能,则必须安装完整的 .NET Framework。 更多信息,请参阅 Windows 窗体部署 文档中的 关于 .NET Framework 4.0 Client Profile 的重要说明 小节。 |
这个示例展示了如何隐藏或显示在设计面板底部的组件面板(Tray)。 这样允许对最终用户隐藏有关的数据源和数据适配器对象。
要这样做,则在 XRDesignMdiController.DesignPanelLoaded 事件处理程序中设置 XRDesignPanel.ShowComponentTray 属性。
要使本示例能正确工作,则 XtraReport1 子类(派生于 XtraReport 类) 应该存在于示例应用程序中。
C# | 复制代码 |
---|---|
using System; using System.Windows.Forms; using System.Drawing.Design; using DevExpress.XtraReports.UserDesigner; // ... private void button1_Click(object sender, EventArgs e) { // Create an End-User Designer form. XRDesignForm designForm = new XRDesignForm(); // Handle the DesignPanelLoaded event. designForm.DesignMdiController.DesignPanelLoaded += new DesignerLoadedEventHandler(DesignMdiController_DesignPanelLoaded); // Load a report into the Designer. designForm.OpenReport(new XtraReport1()); // Show the End-User Designer form, modally. designForm.ShowDialog(); } void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs e) { // Get the Design Panel service from the Designer host. XRDesignPanel designPanel = (XRDesignPanel)e.DesignerHost.GetService(typeof(XRDesignPanel)); // Hide the Component Tray from the Design Panel. designPanel.ShowComponentTray = false; } |
Visual Basic | 复制代码 |
---|---|
Imports System Imports System.Windows.Forms Imports System.Drawing.Design 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() ' Handle the DesignPanelLoaded event. AddHandler designForm.DesignMdiController.DesignPanelLoaded, _ AddressOf DesignMdiController_DesignPanelLoaded ' Load a report into the Designer. designForm.OpenReport(New XtraReport1()) ' Show the End-User Designer form, modally. designForm.ShowDialog() End Sub Private Sub DesignMdiController_DesignPanelLoaded(ByVal sender As Object, _ ByVal e As DesignerLoadedEventArgs) ' Get the Design Panel service from the Designer host. Dim designPanel As XRDesignPanel = _ CType(e.DesignerHost.GetService(GetType(XRDesignPanel)), XRDesignPanel) ' Hide the Component Tray from the Design Panel. designPanel.ShowComponentTray = False End Sub |
Show Me |
---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E905。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |