翻譯|使用教程|編輯:張瑩心|2021-09-23 14:05:53.747|閱讀 169 次
概述:此示例構建具有自動內容更新的實時實時報告。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Stimulsoft Ultimate是用于創建報表和儀表板的通用工具集。該產品包括用于WinForms、ASP.NET、.NET Core、JavaScript、WPF、PHP、Java和其他環境的完整工具集。
Stimulsoft Reports不僅擁有強大的報表導出系統,而且還支持多種報表導出格式,擁有簡單且強大的報表引擎。Stimulsoft Reports基本原則是,用簡單常規的方法創建報表,將不同的技術應用于應用程序。Stimulsoft Reports .NET一個基于.NET框架的報表生成器,能夠幫助你創建結構、功能豐富的報表。不僅界面友好,而且使用便捷,能夠讓你輕松創建所有報表。
點擊下載Stimulsoft Reports .NET v2021.3.1最新版
此示例構建具有自動內容更新的實時實時報告。例如,使用帶有一些文本的報表和帶有兩個系列的圖表。在Form1()初始化方法中,找到必要的報表組件。報告從應用程序資源加載:
private StiText text = null; private StiChart chart = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); stiReport1.Render(); StiComponentsCollection comps = stiReport1.RenderedPages[0].GetComponents(); text = comps["Text1"] as StiText; chart = comps["Chart1"] as StiChart; }該timer1_Tick定時器事件改變所選擇的報告組件(如角度)的屬性,并重繪報告。首先,應用文本旋轉:
private System.Windows.Forms.Timer timer1; private void timer1_Tick(object sender, System.EventArgs e) { if (text == null)return; // Rotate text float angle = text.TextOptions.Angle; angle -= 1f; if (angle < 0) angle = 359; text.TextOptions.Angle = angle; ...接下來,由于圖表樣本有兩個系列,因此應對每個系列進行旋轉:
... // Rotate series 1 angle = ((StiDoughnutSeries)chart.Series[0]).StartAngle; angle -= 1f; if (angle < 0) angle = 359; ((StiDoughnutSeries)chart.Series[0]).StartAngle = angle; // Rotate series 2 angle = ((StiDoughnutSeries)chart.Series[1]).StartAngle; angle += 1f; if (angle > 359) angle = 0; ((StiDoughnutSeries)chart.Series[1]).StartAngle = angle; ...最后,實時更新報告:
... RectangleD rect = stiPreviewControl1.GetComponentRect(text); stiPreviewControl1.InvalidatePageRect(rect.ToRectangle()); rect = stiPreviewControl1.GetComponentRect(chart); stiPreviewControl1.InvalidatePageRect(rect.ToRectangle()); //stiPreviewControl1.View.Invalidate(); }在下面的屏幕截圖中,您可以看到示例代碼的結果:
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn