form1.cs

来自「FastReport的使用和调用方法,适用于任何程序,任何报表格式」· CS 代码 · 共 49 行

CS
49
字号
using System;
using System.Data;
using System.Windows.Forms;
using FastReport;
using FRInterop;

namespace FRDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;
            FastReportService service = FastReportService.Instance;
            service.CustomRegSvr = true;
            service.InitializeService();
            Application.ThreadExit += new EventHandler(Application_ThreadExit);

        }

        void Application_ThreadExit(object sender, EventArgs e)
        {
            FastReportService.Instance.UnloadService();
        }

        static DataSet GetDataSource()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(String.Format("{0}\\customer.xml", Application.StartupPath));
            return ds;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            FastReportService.Instance.ShowDesigner(delegate(TfrxReport report) { report.MainWindowHandle = (int)this.Handle; },
                null, GetDataSource(), null, String.Format("{0}\\Simple list.fr3", Application.StartupPath), null);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            FastReportService.Instance.ShowReport(null, null, GetDataSource(), true, false, null,
                               String.Format("{0}\\Simple list.fr3", Application.StartupPath));
        }

        private void button3_Click(object sender, EventArgs e)
        {
            FastReportService.Instance.ShowDesigner((int)this.Handle, GetDataSource());
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?