【Stimulsoft Reports.WinForms教程】使用全局保存和加载事件

【下载Stimulsoft Reports.Ultimate最新版本】

此示例显示如何在代码中使用“Save”和“Load”事件,您可以在应用程序初始化时将事件监听器添加到StiOptions.Engine.GlobalEvents:

public Form1(){    InitializeComponent();    StiOptions.Engine.GlobalEvents.SavingReportInDesigner +=        new Stimulsoft.Report.Design.StiSavingObjectEventHandler(GlobalEvents_SavingReportInDesigner);    StiOptions.Engine.GlobalEvents.LoadingReportInDesigner +=        new Stimulsoft.Report.Design.StiLoadingObjectEventHandler(GlobalEvents_LoadingReportInDesigner);}

然后指定加载 表时要执行的操作:

...private void GlobalEvents_LoadingReportInDesigner(object sender, Stimulsoft.Report.Design.StiLoadingObjectEventArgs e){    e.Processed = true;    StiReport report = new StiReport();    report.Load("..\..\Reports\SimpleList.mrt");    designerControl1.Report = report;}...

指定 表保存时要执行的操作:

...private void GlobalEvents_SavingReportInDesigner(object sender, Stimulsoft.Report.Design.StiSavingObjectEventArgs e){    if (designerControl1.Report == null) return;    e.Processed = true;    designerControl1.Report.Save("Report.mrt");}

下载示例

标签: 表 表控件StimulsoftWinForms

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年8月1日
下一篇 2018年8月1日

相关推荐

发表回复

登录后才能评论