此示例构建具有自动内容更新的实时实时 告。
此示例构建具有自动内容更新的实时实时 告。例如,使用带有一些文本的 表和带有两个系列的图表。在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 textfloat angle = text.TextOptions.Angle;angle -= 1f;if (angle < 0) angle = 359;text.TextOptions.Angle = angle;...
接下来,由于图表样本有两个系列,因此应对每个系列进行旋转:
...// Rotate series 1angle = ((StiDoughnutSeries)chart.Series[0]).StartAngle;angle -= 1f;if (angle < 0) angle = 359;((StiDoughnutSeries)chart.Series[0]).StartAngle = angle;// Rotate series 2angle = ((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();}
在下面的屏幕截图中,您可以看到示例代码的结果:

Aspose、E-iceblue、FastReport、Stimulsoft等文档/ 表图表类开发工具享超低折扣,如有需要可直接联系在线客服。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!