在VB或C#中使用Dundas图表时如何打印和导出
我在 VB 程序中使用 Dundas Chart Profession 根据我的数据生成图表。现在我的图表可以正常打开,但我不确定如何添加功能以让用户在程序运行后选择打印(和导出)图表。
I'm using Dundas Chart Profession within my VB program to generate a chart based on my data. Right now I have my charts opening fine but I am unsure how to add the functionality to let the user choose to print (and export) the chart once the program is running.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道如何导出图表,但我已经知道如何打印和保存它。
打印:
要打印图表,我在此处<找到了解决方案/a>.这位于 Dundas 数据可视化组件支持页面上,标记为“自定义打印图表的大小”。另外,如果您像我一样想知道他们如何获得 PrintDocument,它位于 System.Drawing.Printing.PrintDocument 下。
保存:
要保存您必须拥有的所有内容,
其中 ChartImageFormat 位于 Dundas.Charting.WinControl 下,而 png 可以是 Dundas.Charting.WinControl.ChartImageFormat 下的任何扩展名。当然,这涉及到必须知道用户想要使用的文件名和路径,因此我研究了如何内置保存对话框,因为我不想自己重新创建它。我在 System.Windows.Forms 下找到了 SaveFiledialog,其中也有打开、加载和打印功能。当然,我已经有了另一份印刷品。
设置它使用的初始目录
然后用 ShowDialog 打开它
I didn't figure out how to export the chart but I have figured out how to print and save it.
To print:
To print the chart I found the solution here. This is on the Dundas Data Visualization Components Support page labeled under "Customizing the size of printed chart". Also in case you are wondering how they got the PrintDocument, like me, it is located under System.Drawing.Printing.PrintDocument.
To save:
To save all you have to have is
Where ChartImageFormat is under Dundas.Charting.WinControl and png can be any extension under Dundas.Charting.WinControl.ChartImageFormat. Of course this ran into having to know the filename and pathway that the user wants to use so I researched how to do the dialog for saving, built in, as I didn't want to recreate it myself. I found the SaveFiledialog under System.Windows.Forms where they also have open, load, and print. Of course I already had the other print.
To set the initial directory it uses is
Then open it with ShowDialog