gpt4 book ai didi

c# - 保存实时图表图像

转载 作者:行者123 更新时间:2023-11-30 21:42:58 25 4
gpt4 key购买 nike

我需要保存并打印来自 cartesian live chart 的图像, 我在 docs and tutorials 搜索过但我找不到任何东西。我怎样才能做到这一点?我在 Visual Studio 2012 Express 中使用 WinForms 和 C#。

最佳答案

您可以简单地将图形控件转换为位图,如this answer 所示。然后将其保存到文件中。使用 LiveCharts example 中的图形控件 (cartesianChart1) :

Bitmap bmp = new Bitmap(cartesianChart1.Width, cartesianChart1.Height);
cartesianChart1.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save("C:\\graph.png", ImageFormat.Png);

即使您的图形位于另一个窗口后面,这也能正常工作。

使用Tatranskymedved's answer打印图像。

关于c# - 保存实时图表图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42112933/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com