zoukankan      html  css  js  c++  java
  • [Dxperience.8.*]XtraReport的设计器,其实用XRDesignFormEx就挺好。

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using DevExpress.XtraReports.UI;
    using DevExpress.XtraReports.UserDesigner;
    using System.Drawing.Design;
    using System.ComponentModel.Design;

    namespace WindowsFormsApplication2
    {
        
    public partial class Form1 : Form
        {
            XtraReport r ;
            
    public Form1()
            {
                InitializeComponent();
            }

            
    void designForm_FormClosing(object sender, FormClosingEventArgs e)
            {
                
    //在此处处理关闭设计器时的操作,主要用来自定义保存数据
                
    //r.SaveLayout(@"C:\1.repx");
            }

            
    void designForm_ReportStateChanged(object sender, ReportStateEventArgs e)
            {
                
    //只要报表发生改变就立即将状态设置为保存
                
    //避免系统默认保存对话框的出现
                if (e.ReportState == ReportState.Changed)
                {
                    ((XRDesignFormEx)sender).DesignPanel.ReportState 
    = ReportState.Saved;
                }
            }

            
    private void Form1_Load(object sender, EventArgs e)
            {
                r 
    = new XtraReport();
                
    //r.LoadLayout(@"C:\1.repx");
                XRDesignFormEx designForm = new XRDesignFormEx();

                
    //隐藏按钮
                designForm.DesignPanel.SetCommandVisibility(new ReportCommand[]{
                    ReportCommand.NewReport,
                    ReportCommand.SaveFileAs,
                    ReportCommand.NewReportWizard,
                    ReportCommand.OpenFile
                }, CommandVisibility.None);


                
    //更改状态
                designForm.ReportStateChanged += new ReportStateEventHandler(designForm_ReportStateChanged);

                designForm.FormClosing 
    += new FormClosingEventHandler(designForm_FormClosing);

                
    // 加载报表. 
                designForm.OpenReport(r);

                
    // 打开设计器
                designForm.ShowDialog();

                designForm.Dispose();
            }
        }
    }
    ----------------------------------- http://www.cnblogs.com/rock_chen/
  • 相关阅读:
    ? ?? 类?
    类 建索引
    访问局域网计算机文件
    JS 在元素后面添加新的元素
    js 网页加载完毕,执行js函数
    设置快捷键(3种方式)
    winform设置textbox设置水印
    ADO.NET 学生管理
    C#整理 条件语句
    ADO.NET 数据访问类查询、属性扩展
  • 原文地址:https://www.cnblogs.com/rock_chen/p/1234103.html
Copyright © 2011-2022 走看看