【下载Stimulsoft Reports.Ultimate最新版本】
此示例构建具有自动内容更新的实时实时 表。例如,使用带有一些文本的 表和带有两个系列的图表。在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();}
示例代码的结果如下图所示:

下载示例
标签: 表解决方案 表 表控件 表设计StimulsoftWinForms
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!