⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 FastReport的使用和调用方法,适用于任何程序,任何报表格式
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -