翻譯|使用教程|編輯:王香|2018-09-03 11:22:18.000|閱讀 384 次
概述:本文主要講解在Stimulsoft中如何使用全局保存和加載事件
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
【下載Stimulsoft Reports.Ultimate最新版本】
此示例顯示如何在代碼中使用“Save”和“Load”事件,您可以在應(yīng)用程序初始化時(shí)將事件監(jiān)聽器添加到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); }
然后指定加載報(bào)表時(shí)要執(zhí)行的操作:
... 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; } ...
指定報(bào)表保存時(shí)要執(zhí)行的操作:
... private void GlobalEvents_SavingReportInDesigner(object sender, Stimulsoft.Report.Design.StiSavingObjectEventArgs e) { if (designerControl1.Report == null) return; e.Processed = true; designerControl1.Report.Save("Report.mrt"); }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@ke049m.cn