翻譯|使用教程|編輯:王香|2018-09-03 11:22:18.000|閱讀 384 次
概述:本文主要講解在Stimulsoft中如何使用全局保存和加載事件
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
【下載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");
}
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn