使用graphics3d在Steema Teechart中打印预览问题

时间:2013-12-13 06:36:49

标签: c# .net printing teechart

我正在使用tchart和图形3d进行实时图表绘制。每当我尝试为图表调用打印预览时,预览页面只是一个空白页面,实际图表背景变为黑色。我尝试了不同的技巧,我发现这个printpreview在普通画布上工作。但是一旦我写完这条线

Chart1.Graphics3D = new Graphics3DDirect2D(Chart1.Chart);                  

打印预览不起作用。

如果我调用导出功能,例如导出到pdf功能然后pdf文件已导出图表,替代路线可以打印pdf。 但我想使用打印预览,并为用户提供根据需要更改边距和其他内容的功能。

演示项目的链接是http://www.filedropper.com/sampleprojecttchartprint 视频描述问题的链接是http://tinypic.com/r/2ufg7f5/5 我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

TeeChart使用的包装器存在限制,此处记录了一个限制: http://bugs.teechart.net/show_bug.cgi?id=356

根据建议,解决方法是使用GDI +画布进行图像导出,例如

private void InitializeChart()
{
  tChart1.Graphics3D = new Graphics3DDirect2D(tChart1.Chart);
  tChart1.Aspect.View3D = false;
  FastLine series = new FastLine(tChart1.Chart);
  series.FillSampleValues(1000);

}

TChart tChart2;

private void button1_Click(object sender, EventArgs e)
{
  if(tChart2 == null) tChart2 = new TChart();

  MemoryStream ms = new MemoryStream();
  tChart1.Export.Template.Save(ms);
  ms.Position = 0;
  tChart2.Import.Template.Load(ms);

  tChart2.Export.Image.PNG.Width = tChart1.Width;
  tChart2.Export.Image.PNG.Height = tChart1.Height;
  tChart2.Export.Image.PNG.Save(@"C:\tmp\direct2d.png");
}
相关问题