我发现了这个类似的问题,我试图实施,但没有奏效。
如果有人想将图表另存为图像,我有一个创建图表的类并有第二个构造函数。但是,正在保存的图像只是表单背景,而不是图表。这是我的代码。
public ChartForm(String path)
{
InitializeComponent();
SaveGraphAsImage(path);
}
private void SaveChartAsImage(String path)
{
bmp = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bmp, new Rectangle(0, 0, this.Width, this.Height));
this.bmp.Save(path + this.Name, System.Drawing.Imaging.ImageFormat.Jpeg);
}